Pcornel
Observability · Metrics

Exemplars

Cheat sheet · https://pcornel.dk/topic.php?topic=6238

Back to the Topic

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.

Remember

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

First 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

Verify in this order

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

Where it usually breaks

Exemplars pointing to traces dropped by sampling lead to empty trace views.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6238

Confirmation

Confirm action

Continue?