Monitoring glossary
What is context propagation?
Context propagation is how a trace survives the jump from one service to the next. Without it, every service records its own disconnected fragment.
3 min read9 sectionsUpdated
On this page
Key points
- The trace context travels in request headers, normally the W3C traceparent header.
- Instrumented HTTP clients and servers handle it for you; queues and custom transports often need manual work.
- Baggage carries extra key-value context, but everything in it is sent to every downstream service.
- Broken propagation shows up as split traces and missing edges on the service map.
How it works
When service A calls service B, A's instrumentation injects the current trace ID and span ID into the outgoing request. B's instrumentation extracts them and starts its server span as a child of A's client span. Both report the same trace ID, so the backend can draw one tree.
The W3C Trace Context standard defines two headers:
traceparent: version, trace ID, parent span ID and flags (including whether the trace is sampled).tracestate: optional vendor-specific data.
traceparent: 00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01
tracestate: vendor1=opaque-valueQueues, jobs and other transports
HTTP and gRPC instrumentation propagates automatically. Message queues and background jobs are the most common gap. The pattern is the same: inject the context into the message headers when you publish, and extract it when you consume.
import { context, propagation, trace } from '@opentelemetry/api';
// producer: copy the current context into the message headers
const headers: Record<string, string> = {};
propagation.inject(context.active(), headers);
await queue.publish('invoices', { body, headers });
// consumer: continue the trace from the message headers
const parent = propagation.extract(context.active(), message.headers);
await context.with(parent, () =>
trace.getTracer('worker').startActiveSpan('render invoice', async (span) => {
try { await render(message.body); } finally { span.end(); }
}),
);Baggage
Baggage is a second header that carries arbitrary key-value pairs, such as tenant.id=acme, to every downstream service. It is handy for routing and tagging, but remember that it is sent on every hop, including to third parties if you call them. Never put secrets or personal data in baggage, and keep it small.
Signs propagation is broken
- Two traces where you expected one: the downstream service starts a new root span.
- Missing edges on the service map: a service appears with no caller.
- Orphan spans: spans whose parent ID never shows up.
Common causes: an uninstrumented HTTP client, a proxy that strips unknown headers, mixed propagators (for example B3 on one side and W3C on the other), or a queue without manual injection.
Do I need to propagate context to third-party APIs?
Instrumented clients will send traceparent anyway. It is harmless, since it contains only random IDs, but baggage can leak data, so keep baggage internal.
What is B3?
An older propagation format from Zipkin. OpenTelemetry supports it, but W3C Trace Context is the default and the one to standardize on.
Does the browser propagate context?
Front-end tracing libraries can add traceparent to fetch calls, but cross-origin requests need the API to allow that header in CORS.
Check it now, free
- DNS lookup: A, AAAA, CNAME, MX, TXT, NS, SOA and CAA records.
- HTTP headers checker: See the raw response headers of any URL.
Related reading
- What is trace sampling?: Trace sampling explained: head vs tail sampling, parent-based rules, what sampling does to your counts, and how to keep every error while cutting costs.
- What is OpenTelemetry?: OpenTelemetry explained: the open standard for traces, metrics and logs, how the SDK, OTLP and the Collector fit together, a worked example and how to start.
- ECS and Fargate monitoring: Monitor Amazon ECS and Fargate: CPU and memory per service, stopped-task reasons, ALB target health, logs and traces.
- How to monitor a Next.js app: How to monitor a Next.js app in production: uptime checks, Core Web Vitals, server and edge errors, OpenTelemetry traces for SSR and API routes, and alerts.
- OpenTelemetry for FastAPI: Trace a FastAPI service with OpenTelemetry: instrument the app, async database drivers and httpx, run uvicorn workers correctly and export.
- OpenTelemetry for Go: Instrument a Go service with OpenTelemetry: set up the tracer provider, wrap net/http with otelhttp, pass context everywhere and export the spans.
Watch your own site and services with VitalRix
Uptime checks, APM, logs, real-user monitoring, alerts and status pages in one place. Every product has a free tier and no credit card is needed.