Observability / Intermediate: instrumentation and interpretation / Lesson 14
Metric exemplars and trace links
Connect an aggregate measurement to an example trace while accounting for selection, retention, and privacy.
On this page
Lesson goals
- Explain an exemplar’s role and representativeness limits.
- Test linkage, retention, and privacy across the pipeline.
Move from aggregate to example
A metric can reveal that request latency increased but may not show the individual path responsible for a particular measurement. An exemplar is an example measurement associated with aggregated metric data and can carry trace context when supported. Start with the metric’s population, unit, and time window before selecting an exemplar. One example helps investigate a hypothesis; it does not represent every slow request.
Understand collection and selection
Exemplar availability depends on instrumentation, selection, export, storage, and query support across the actual pipeline. A trace identifier may be attached when a measurement occurs in an appropriate trace context, but not every measurement is retained as an exemplar. The synthetic record below shows a possible association, not an executed result. Document selection and retention so responders do not infer completeness from a few visible links.
metric: request_duration
measurement: 0.8 seconds
trace context: synthetic-trace-id
selection: illustrative only
The values are illustrative, not an export format or executed result.
Follow the link with context
When an exemplar links to a trace, compare the metric timestamp, resource identity, operation, and measurement with the trace’s recorded spans. Sampling or retention can mean the trace is unavailable even when the exemplar remains visible. A trace can also be incomplete. Preserve these limitations and correlate with logs or other signals from the same request where authorized, without placing trace identifiers into unbounded metric labels.
Protect correlation data
Trace context and attributes can reveal operational or user information when combined with other records. Define access, retention, and allowed attributes for both metrics and traces, and use synthetic identifiers in training. The second example is a review checklist rather than configuration. Verify redaction at the appropriate boundary and avoid storing credentials, personal data, or raw request payloads merely to make a link convenient.
review: trace access and retention
review: allowed attributes and redaction
review: no credentials or raw customer payload
The checklist identifies checks; it does not guarantee privacy by itself.
Test the complete path
In an isolated lab, create a synthetic request and measurement under a trace context, then inspect whether the configured pipeline exports an exemplar and whether the backend can navigate to the trace. Record sampling and retention settings and any unsupported stage. Test a case with no retained trace and ensure the dashboard remains interpretable. A missing exemplar does not prove that the request or measurement did not happen.
Common errors and fixes
Treating one exemplar as representative of all requests
- Why it happens
- Exemplar selection and sample limits were ignored.
- How to fix it
- Compare with the aggregate metric and request population.
- Prevent it next time
- Document selection and coverage.
Treating a missing trace link as proof no request occurred
- Why it happens
- Sampling or retention can differ.
- How to fix it
- Inspect export, storage, and other signals.
- Prevent it next time
- Monitor the pipeline and retention limits.
Adding a trace ID as a metric label
- Why it happens
- Example context was confused with aggregation dimensions.
- How to fix it
- Remove the dimension through a migration plan and protect consumers.
- Prevent it next time
- Review cardinality and privacy before adding attributes.
2 practice exercises
1. You see an exemplar for a slow request. Does it explain the entire increase?
Show worked solution
No. Use it as a hypothesis, then compare the metric population and other traces and evidence while accounting for selection.
2. The exemplar is visible but the trace is unavailable. What do you inspect?
Show worked solution
Inspect sampling, export, retention, and access across both paths; do not infer that the request did not occur.
Key takeaways
- An exemplar is a selected example, not the full request distribution.
- Verify linkage, retention, and privacy across the pipeline.