# Distributed Tracing with OpenTelemetry

> Instrument services with the vendor-neutral OpenTelemetry standard and follow requests across services in Jaeger or Tempo. Free notes, key concepts, resources...

Canonical: https://www.internhack.in/roadmaps/tracks/devops/tracing-opentelemetry
Last updated: 2026-11-28

Instrument services with the vendor-neutral OpenTelemetry standard and follow requests across services in Jaeger or Tempo.

Intermediate · about 7 hours · difficulty 3/5

Learn first: [Observability Fundamentals](https://www.internhack.in/roadmaps/tracks/devops/observability-fundamentals)

In a system of many services, one slow request might touch ten of them. **Distributed tracing** records the journey so you can see which hop was slow or failed.

### Concepts

- A **trace** is one request end to end; it is a tree of **spans**, each with a name, start time, duration, status and **attributes**.
- **Context propagation** passes the trace ID between services, usually in the W3C `traceparent` HTTP header or message metadata.
- **Sampling** controls cost: **head sampling** decides at the start (keep 10%); **tail sampling** decides after the trace completes (keep all errors and slow traces).

### OpenTelemetry (OTel)

OpenTelemetry is the CNCF standard for generating telemetry: APIs and SDKs for every major language, **auto-instrumentation** for common frameworks and libraries, semantic conventions for attribute names, and the **OTLP** protocol.

The **OpenTelemetry Collector** receives, processes (batching, filtering, redaction, tail sampling) and exports telemetry to any backend. Run it as an agent per node and/or a gateway deployment. Because instrumentation is vendor neutral, you can switch backends without touching application code.

### Backends

**Jaeger** and **Grafana Tempo** are popular open-source trace stores; commercial APM tools accept OTLP too. Link traces to logs (trace ID in log lines) and to metrics (exemplars) for fast pivots.

### What to look for in a trace

Long gaps between spans (queueing), sequential calls that could be parallel, N+1 database queries, retries, and the first span that set an error status.

**Good enough to move on:** you can auto-instrument two services that call each other, send spans through a Collector to Jaeger or Tempo, configure tail sampling that keeps errors, and find the slow span in a trace.

## Key concepts

- **Traces, spans and attributes**
- **Context propagation and traceparent**
- **OpenTelemetry SDKs and auto-instrumentation**
- **OpenTelemetry Collector pipelines**
- **Head vs tail sampling**
- **Jaeger and Grafana Tempo**
- **Linking traces, logs and metrics**

## Mini project

Build two small services where one calls the other and a database, auto-instrument both with OpenTelemetry, route telemetry through a Collector to Jaeger or Tempo, and inject an artificial delay you then locate from the trace view.

## Check yourself

A trace shows service A's span but service B's spans appear as a separate trace. What most likely broke?

## Free resources

- [OpenTelemetry documentation](https://opentelemetry.io/docs/) (OpenTelemetry)
- [Jaeger documentation](https://www.jaegertracing.io/docs/) (Jaeger)
- [Grafana Tempo documentation](https://grafana.com/docs/tempo/latest/) (Grafana Labs)

Previous: [Elastic Stack (ELK) and OpenSearch](https://www.internhack.in/roadmaps/tracks/devops/elk-stack) · Next: [Alerting That Does Not Burn People Out](https://www.internhack.in/roadmaps/tracks/devops/alerting)

## More in Observability: Metrics, Logs, Traces and SLOs

- [Observability Fundamentals](https://www.internhack.in/roadmaps/tracks/devops/observability-fundamentals)
- [Prometheus and Grafana](https://www.internhack.in/roadmaps/tracks/devops/prometheus-grafana)
- [Centralised Logging with Loki](https://www.internhack.in/roadmaps/tracks/devops/loki-logging)
- [Elastic Stack (ELK) and OpenSearch](https://www.internhack.in/roadmaps/tracks/devops/elk-stack)
- [Distributed Tracing with OpenTelemetry](https://www.internhack.in/roadmaps/tracks/devops/tracing-opentelemetry)
- [Alerting That Does Not Burn People Out](https://www.internhack.in/roadmaps/tracks/devops/alerting)
- [SLIs, SLOs and Error Budgets](https://www.internhack.in/roadmaps/tracks/devops/slo-error-budgets)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [DevOps Engineer Roadmap](https://www.internhack.in/roadmaps/tracks/devops)
