Use it to connect metrics with traces.
Exemplars
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.
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.
request traced → histogram observation with trace_id → exemplar stored → graph → trace
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
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.
Requires instrumentation that records exemplars, OpenMetrics scrape format, Prometheus --enable-feature=exemplar-storage, and a Grafana data source link to the tracing backend.
curl -s -H 'Accept: application/openmetrics-text' http://<target>/metrics | grep '# {trace_id'— first check for this topiccurl -s localhost:9090/-/ready— Prometheus readycurl -s 'localhost:9090/api/v1/query?query=up'— scrape targets up/downpromtool 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
| Step | Requirement |
|---|---|
| Instrumentation | Library records exemplars when an active, sampled span exists (OpenTelemetry SDKs and recent Prometheus client libraries do) |
| Exposition | OpenMetrics format (application/openmetrics-text), not the classic text format, which cannot carry exemplars |
| Prometheus | Started with --enable-feature=exemplar-storage; storage.exemplars.max_exemplars sized |
| Grafana | Prometheus data source configured with an exemplars link to the tracing data source (Tempo, Jaeger) and the trace ID label name |
| Tracing backend | The 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
| Symptom | Cause |
|---|---|
| No dots | Classic 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 latency | Sampling keeps mostly fast traces; tail-sample slow ones |
Keeping traces that have exemplars (or tail-sampling slow and error traces) makes the links reliable.
Common mistakes
- Expecting exemplars without tracing enabled.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
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.