Pcornel
Browse topics
Options
Recent
Favorites
Observability · Technical reference

Exemplars

Direct answer

Exemplars attach trace IDs to individual metric samples (typically histogram buckets) so you can jump from a latency spike in a graph directly to a matching trace.

When to use this

Use it to connect metrics with traces.

First 30 seconds

1. Exemplars present: curl -s -H 'Accept: application/openmetrics-text' http://<target>/metrics | grep '# {trace_id'.

2. Prometheus feature flag enabled.

3. Query exemplars API: /api/v1/query_exemplars.

4. Grafana exemplar link to Tempo/Jaeger.

5. Click through works.

Operational verification

request traced → histogram observation with trace_id → exemplar stored → graph → trace

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
OpenTelemetry / Prometheus / Grafana / common metrics-log-trace pipelines
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformOpenTelemetry / Prometheus / Grafana / common metrics-log-trace pipelines
Scope / prerequisiteUse it to connect metrics with traces.
What next?2 suggested next steps
Evidence0
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

2 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 How to verify Verify boundary

Click an exemplar on a latency panel and confirm the trace opens. Check sampling keeps the traces that exemplars refer to.

Step 2 Common failures Narrow the fault

Exemplars pointing to traces dropped by sampling lead to empty trace views. Text format scrapes drop exemplars. Without a configured trace data source link, exemplars cannot be opened.

Key points

Requires instrumentation that records exemplars, OpenMetrics scrape format, Prometheus --enable-feature=exemplar-storage, and a Grafana data source link to the tracing backend.

Key checks
  • curl -s -H 'Accept: application/openmetrics-text' http://<target>/metrics | grep '# {trace_id' — first check for this topic
  • curl -s localhost:9090/-/ready — Prometheus ready
  • curl -s 'localhost:9090/api/v1/query?query=up' — scrape targets up/down
  • promtool check config prometheus.yml — config valid
ReferenceWhat it is1 section · depth on demand

How it works

Instrumentation libraries attach the current trace context when recording an observation. Exemplars are exposed only in the OpenMetrics format, which Prometheus negotiates during scrape.

ReferenceImportant terms & boundaries3 sections · depth on demand

Using exemplars

Exemplars attach a trace ID to a specific histogram observation, so a latency spike on a dashboard links to an actual slow trace. Requirements: instrumentation that records exemplars (OpenTelemetry SDKs, Prometheus client libraries with trace context), --enable-feature=exemplar-storage on Prometheus (or a backend that stores them), and a Grafana data source link to Tempo/Jaeger.

In depth

What an exemplar is

A histogram bucket counts how many requests took 1–2 seconds; an exemplar attaches one concrete example to that observation — its trace ID, value and timestamp. On a latency panel it appears as a dot; clicking it opens that exact slow request's trace.

The chain that must work end to end

StepRequirement
InstrumentationLibrary records exemplars when an active, sampled span exists (OpenTelemetry SDKs and recent Prometheus client libraries do)
ExpositionOpenMetrics format (application/openmetrics-text), not the classic text format, which cannot carry exemplars
PrometheusStarted with --enable-feature=exemplar-storage; storage.exemplars.max_exemplars sized
GrafanaPrometheus data source configured with an exemplars link to the tracing data source (Tempo, Jaeger) and the trace ID label name
Tracing backendThe referenced trace was kept by sampling

What it looks like on the wire

http_server_request_duration_seconds_bucket{route="/cart",le="2.5"} 1043 # {trace_id="4bf92f3577b34da6a3ce929d0e0e4736"} 1.87 1795770843.120

Querying

Exemplars are returned alongside normal range queries (/api/v1/query_exemplars); in Grafana enable Exemplars on the query. Use them on latency histograms and error counters where jumping to an example request answers "why?" faster than any aggregate.

Common reasons the dots are missing or empty

SymptomCause
No dotsClassic text format scraped; feature flag off; no active span when recording
Dots open "trace not found"Trace dropped by head or tail sampling, or retention shorter in the trace store
Dots only at low latencySampling keeps mostly fast traces; tail-sample slow ones

Keeping traces that have exemplars (or tail-sampling slow and error traces) makes the links reliable.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

Common mistakes

  • Expecting exemplars without tracing enabled.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Terminology layer

Terms & aliases

Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.

Aliases that resolve here
exemplarsprometheus exemplarsmetrics to traces
Confirmation

Confirm action

Continue?