Intermediate LevelSystem Design & Architecture
How does OpenTelemetry collect trace spans across microservice boundaries?
β Interview Prompt: Explain OpenTelemetry, Distributed Tracing, W3C `traceparent` header propagation, Trace IDs, Span IDs, and APM visualization.
OpenTelemetry standardizes distributed tracing context propagation across microservices:
Context Propagation Workflow:
1
Originating service generates a global 128-bit Trace ID and 64-bit Span ID.
2
Injects W3C header into outbound HTTP requests: 'traceparent: 00-4bf92f3577b...-00f067aa0ba902b7-01'.
3
Downstream services extract the 'traceparent' header, attach their own child Span ID, and pass it along, allowing APMs (Jaeger, Datadog) to construct complete request timelines!
Code Implementation Example
http
GET /api/v1/orders HTTP/1.1
Host: order-service.internal
traceparent: 00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01
tracestate: vendor=123π‘W3C Trace Context traceparent header propagation across microservices.
π― Interview Key Takeaway
Propagate W3C traceparent headers across microservice calls to enable end-to-end distributed tracing visibility.
#System Design#Distributed Tracing#OpenTelemetry#W3C#Intermediate
Back to all System Design & Architecture Questionsβ