Part 14 · Observability & Production Debugging
14.1 / Tracing

Trace context, sampling và OpenTelemetry pipeline

Trace mô tả causal/request path bằng spans; OTel chuẩn hóa instrumentation/transport, không phải storage backend.

Span model

Trace ID, span ID, parent/link, name/kind, start/duration, attributes/events/status and resource/service metadata. Name stable low-cardinality operation, raw URL/user data attributes only with privacy/cost policy.

Propagation

W3C Trace Context over HTTP; messaging inject/extract headers. Consumer span may child of receive/process or use links for batch/fan-in; model async semantics explicitly. Broken propagation yields separate traces but correlation IDs may assist.

Sampling

Head sampling cheap/early but may miss rare errors; tail sampling sees completed trace but requires collector buffering/resources. Policies retain errors/slow/important tenants without putting tenant IDs into metrics. Sampling decision propagated.

Collector

Receivers→processors (batch, memory limiter, attributes, tail sampling)→exporters. Agent/gateway topologies. Backpressure/retry/queue/disk buffer and drop metrics; collector failure must not stall app.

Baggage

Propagated key-values across services, potentially copied to telemetry. Cost/security high: no secrets/PII/unbounded values, validate trust. Baggage is not authorization context by default.

OpenTelemetry Concepts · W3C Trace Context · OTel Collector
← LoggingProfiling →