Metrics and traces Recommended
Trace requests across services
When a request crosses services, record one trace that follows it, and pass the trace context with the W3C traceparent header.
How to do it
Add OpenTelemetry to each service, so incoming and outgoing calls create spans automatically. Keep every error trace and a sample of the rest. Use the trace ID as the request ID in logs.
Example
traceparent: 00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01
How to check
Make one request that crosses two services on staging. The tracing tool shows one trace with spans from both, and the logs carry the same trace ID.
For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers operations playbook: https://agentwranglers.se/playbook/operations/metrics-and-traces/distributed-tracing.