Skip to main content

OpenTelemetry cheatsheet

A one-page reference for OpenTelemetry. For instrumentation deep-dives and Collector pipeline config, see the complete guide.

๐Ÿ“– Full guide: OpenTelemetry โ†’ Intermediate
Learn this in 5 minutes5 min
  1. Begin with the Spans & traces card
  2. Then the Context propagation and Three signals cards
  3. Treat the other 4 cards as lookups โ€” scan by card title when you need one
  4. Open the full guide when a card isn't enough

Spans & tracesโ€‹

Trace (trace_id=abc123)
โ””โ”€ span: HTTP GET /checkout 120ms
โ”œโ”€ span: validate-cart 15ms
โ”œโ”€ span: charge-card 80ms
โ””โ”€ span: send-confirmation 10ms

A span has a name, start/end time, attributes, events, and status (OK/Error). A trace is a tree of spans sharing one trace ID.

Context propagationโ€‹

The active SpanContext (trace_id, span_id, trace_flags) is injected into outgoing request headers and extracted downstream so the next service's span becomes a child of the caller's โ€” this is what stitches a distributed trace together across services.

Three signalsโ€‹

SignalAnswers
Traceswhere did the request go, and where was it slow
Metricshow much / how often, aggregated over time
Logswhat exactly happened at a point in time

Architecture: API, SDK, Collectorโ€‹

  • API โ€” vendor-neutral instrumentation surface your code calls.
  • SDK โ€” the implementation (sampling, batching, exporting).
  • Collector โ€” a separate process that receives, processes, and exports telemetry โ€” decouples your app from any specific backend.

Instrumentation: auto vs manualโ€‹

Auto-instrumentation (agent/library hooks) gets you 80% for free with zero code changes. Manual spans/attributes fill the gap for business-specific context auto-instrumentation can't know about.

Samplingโ€‹

Head-based sampling decides at trace start (cheap, may miss rare errors). Tail-based sampling decides after seeing the full trace (catches errors/ slow traces reliably, but needs the Collector to buffer).

Common pitfallsโ€‹

  • No context propagation across an async boundary (queue, background job) โ†’ broken traces.
  • Over-instrumenting โ†’ noisy, expensive traces nobody reads.
  • Sampling too aggressively โ†’ missing the rare error that mattered.
See: Common Pitfalls & Debugging