OpenTelemetry

OpenTelemetry (OTel) is the vendor-neutral standard for instrumenting applications with telemetry — traces, metrics, and logs. You instrument your code once against OTel's APIs, then export the data to whatever backend you choose (Prometheus, Datadog, Jaeger, Grafana) without rewriting instrumentation.

That portability is the whole point: it ends vendor lock-in at the instrumentation layer. Its standout capability is distributed tracing — following a single request across services to see exactly where time and failures occur.

TL;DR

Quick Example

Wrap an operation in a span; OTel propagates the trace context to downstream calls automatically:

Core Concepts

The Collector

The OpenTelemetry Collector is a separate process (sidecar, daemonset, or central gateway) that decouples your apps from backends. It can:

Best Practices

Common Mistakes

Broken trace context

Sampling that hides failures

FAQ

What problem does OpenTelemetry solve?

It standardizes how you produce telemetry, so you instrument once and aren't locked to a vendor's SDK. Switch or add backends (Datadog, Jaeger, Grafana) by reconfiguring exporters — no re-instrumentation. It also unifies traces, metrics, and logs under one project.

What is context propagation and why does it matter?

It's passing the trace and span IDs from one service to the next (via HTTP headers or message metadata) so all the work for one request joins a single trace. If any hop drops the context, the trace fragments and you lose the end-to-end picture — the main value of tracing.

What is the OpenTelemetry Collector?

A standalone agent that receives telemetry from your services, processes it (batching, sampling, enrichment), and exports it to backends. It decouples apps from vendors, so you can change or fan out destinations centrally without redeploying instrumented code.

How should I sample traces?

Enough to control cost while keeping the traces you need. Head-based sampling decides up front (cheap but can drop errors); tail-based sampling decides after seeing the whole trace, so you can keep all errors and slow requests. Prefer tail-based for debugging value at scale.

Related Topics

References