How to Debug Production with Observability Data
Debug a production issue methodically: start from the symptom metric, narrow by time and scope, follow the trace, and confirm with logs.
On this page
Introduction
A production issue is a puzzle with an unknown cause and a clock ticking, and the observability data is the evidence. Debugging well is using the evidence methodically: start from the user-visible symptom, narrow it by time and scope, follow a trace to the slow or failing hop, and confirm with the logs. A methodical investigation finds the cause faster and leaves the system better instrumented for the next incident.
This tutorial covers starting from the symptom, narrowing by time and scope, following the trace and confirming with logs, and recording the gap and the fix. The examples use metrics, traces, and logs, and the method applies to any system with the three signals.
Start from the symptom the user feels
The investigation starts at the symptom, which is what the user experiences: a latency spike, an error spike, a missing page. Open the health dashboard and read the symptom signals, and note two things: when the symptom started and which endpoints or routes it affects. The start time is the strongest clue, because it correlates with a change, and the scope narrows the surface.
Do not start from a cause metric. CPU may be high and unrelated, and starting there sends the investigation down a path that may be a coincidence. Start from the symptom, then look at the causes to explain it. This keeps the investigation anchored to the user’s experience, which is what matters and what the alert fired on.
Narrow by time and scope, and correlate with a change
Slice the symptom by the labels that narrow it: by route, by status, by instance, by region. A spike that affects one route points at that route’s code or its dependency; a spike that affects one instance points at that instance, perhaps a bad host. The slice separates a fleet-wide problem from a local one and points the investigation.
Correlate the start time with the changes: a deploy, a configuration change, a traffic shift, a dependency change. An anomaly that begins within minutes of a deploy is most likely caused by it, and the deploy is the first thing to check. The dashboard with the deploy markers makes this a glance rather than a search through the change history.
# narrow the symptom: which route, which status, which instance
sum(rate(http_requests_total{status=~"5.."}[5m])) by (route) # which route
sum(rate(http_request_duration_seconds_sum[5m])) by (instance) # which instance
# and compare the start time to the deploy timeline
Follow the trace to the slow hop
For a slow request, the trace locates the hop: find a request from the affected period, read its span tree, and find the span whose duration dominates its parent. That span, and whether it has a long child, points at the code or the dependency. The trace turns where is the time gone into a specific span, which is the key step.
For a failing request, the trace shows which span recorded the error and where in the request it occurred. The failing span’s service and operation point at the cause, and its attributes carry the detail the span recorded. The trace localizes the failure to an operation, and the logs confirm the specifics.
# the trace localizes: the span that dominates its parent is the slow hop
# GET /checkout 3200ms
# ├─ POST payments 3000ms <- the slow hop
# │ └─ db.query 40ms <- the payments service itself is slow, not its db
# read the span tree, find the deepest long span
Confirm the cause with the logs
The trace localizes, and the logs confirm. Filter the logs by the request id from the trace or the alert, and read the lines of the failing request: the exception, the validation error, the retry, the timeout. The log gives the specific detail the span’s attributes may not, and it confirms the hypothesis the metric and the trace formed.
Read the logs of the affected period and scope, not the whole log, so the volume is manageable. Filter by the time window, the route, and the level, and read the errors first. The logs are the detail signal, and the investigation uses them to confirm and to explain, after the metric detected and the trace localized.
# confirm with the logs of the specific request and the affected period
jq -c 'select(.requestId == "4f9c..." or (.level == "error" and .route == "/checkout"))' app.log
# read the exception and the timing to confirm the trace's slow hop
Record what the data showed and fill the gap
Write down what the data showed and what it did not: the symptom, the narrowing, the trace, and the confirmation. The record is the basis of the fix and the postmortem, and it is where the investigation’s findings live rather than in someone’s memory. A finding that is not written down is lost when the responder moves on.
Note the instrument that was missing: a metric that would have shown the cause, a log field that would have confirmed it, a span that would have localized it. Add the missing instrument after the incident, so the next one is faster. This is how the observability improves into a system that answers the questions the incidents ask, rather than being assembled blindly.
Test the investigation path in a game day
Practice the investigation in a game day: inject a failure and have a responder find it using only the observability data, timing how long it takes. The drill reveals the gaps: a missing span, an unclear dashboard, a log field that is absent. Fix the gaps, and the next incident is faster because the path was walked when the pressure was low.
# game day: inject a slow dependency and time the investigation
node scripts/inject-failure.mjs slow-downstream
# the responder starts at the symptom metric, narrows, reads the trace, confirms with logs
# record the time and the gaps found, and fill them
Common pitfalls
Starting from a cause metric that may be a coincidence, not narrowing by route and instance so a local problem looks fleet-wide, ignoring the start time and the recent change, reading the whole log instead of filtering, and not recording the gap so the next incident is equally slow are the recurring mistakes. Starting from the symptom, narrowing and correlating, following the trace and confirming with logs, and recording and filling the gap address them.
Conclusion
Debug production with the observability data methodically. Start from the user-visible symptom and its start time, narrow by route and instance and correlate with a change, follow the trace to the slow hop, confirm with the logs, and record the gap and fill it. Self-check by walking the path in a game day and timing it, then fixing the gaps found. Then an incident is solved with evidence, and the system is better instrumented for the next one.
Sources: Google SRE: Effective troubleshooting, OpenTelemetry: Traces, metrics, logs, Brendan Gregg: The USE method.
FAQ
- Where do I start a production investigation?
- From the symptom the user feels, in the metrics, and the time it started. The symptom narrows the surface, and the start time is correlated with a change. From there, the traces locate the slow hop and the logs confirm the detail.
- What if the data is not there?
- Note the gap and add the instrument after, so the next incident has it. The investigation ends with the missing metric, log, or span added, which is how the observability improves incident by incident rather than being assembled in advance.
Report a problem with this articleOpens a pre-filled issue on GitHub.