OpenTelemetry is the industry standard for distributed tracing, metrics, and logging. Its Node.js SDK provides TracerProvider, Span, and propagation APIs for instrumenting services and sending telemetry to backends like Jaeger or an OTLP Collector.
0 / 5 completed
1 / 5
What is a TracerProvider in OpenTelemetry?
The TracerProvider is the root of the OpenTelemetry tracing SDK. You configure it with a SpanExporter (where spans are sent) and a SpanProcessor (e.g., BatchSpanProcessor), then call provider.register() to make it the global provider. It creates Tracer instances via provider.getTracer('instrumentationName').
2 / 5
What is a Span in OpenTelemetry distributed tracing?
A Span represents a single operation within a distributed trace. Spans have a traceId (shared across a distributed request chain) and a spanId (unique per span). They record attributes (key-value metadata), events (timestamped annotations), and a status (OK/ERROR), and parent-child relationships form the trace tree.
3 / 5
What is the purpose of SpanKind in OpenTelemetry?
SpanKind semantically classifies spans: SERVER for incoming HTTP/RPC requests, CLIENT for outgoing calls, PRODUCER for message queue sends, CONSUMER for queue receives, and INTERNAL for operations that don't cross a process boundary. Observability backends use SpanKind to group and visualise service topology.
4 / 5
What is context propagation in OpenTelemetry and how is it typically achieved over HTTP?
Context propagation transmits the active trace context across service boundaries. OpenTelemetry uses propagation.inject(context, carrier) to write headers (typically W3C traceparent and tracestate) onto outgoing HTTP requests, and propagation.extract(context, carrier) on the receiving side to resume the same trace.
5 / 5
What is the role of a SpanExporter in OpenTelemetry Node.js?
A SpanExporter is the sink for finished spans. Common exporters include OTLPTraceExporter (sends to an OpenTelemetry Collector via HTTP or gRPC), JaegerExporter, and ConsoleSpanExporter (for debugging). The exporter is wired to a SpanProcessor — typically BatchSpanProcessor — which batches spans before export to reduce network overhead.