Debug (Log → Trace → Metrics)
Overview
This skill is for debugging with existing telemetry. It does not focus on adding instrumentation (use observability when telemetry gaps block triage).
Goal: turn “something is broken/slow” into:
- a concrete symptom + impact statement,
- an evidence-backed hypothesis (or a small set of competing ones),
- a mitigation (rollback/flag/scale) when needed,
- a short list of fix + follow-up tasks.
Workflow
0) Establish ground truth (2–5 minutes)
Capture:
- Environment (
local/dev/staging/prod) and time window (start/end).
- Symptom (what’s failing/slow) and impact (SLO/user-visible blast radius).
- One exemplar: request/trace ID, job run ID, message ID, or timestamped log line.
1) Logs (find the exemplar and its correlation IDs)
- Find the first error/timeout log line closest to the symptom window.
- Identify correlation keys (prefer stable IDs):
traceId, requestId, spanId
op (route template / RPC method / job name / message type)
- error code/type (typed error envelope, gRPC status, HTTP status)
- Pull the full log story for the exemplar (start → downstream call(s) → failure).
Copy/paste helpers live in references/commands.md.
2) Trace (turn the exemplar into a dependency hypothesis)
If you have a traceId, use it.
- Open the trace and confirm the root span matches the suspected operation (
op).
- Identify:
- the slowest span(s),
- the first error span(s),
- retries (multiple similar child spans),
- deadline/time budget signals (deadline exceeded, timeout errors).
- Convert that to a dependency statement:
- “
service A is timing out calling service B method X”
- “DB query
Y is slow / missing index / deadlocked”
- “Queue consumer is failing on message type
T (poison message)”
If you cannot find/interpret traces, fall back to logs + metrics and consider adding missing telemetry via observability.
3) Metrics (confirm blast radius + regression)
Use metrics to answer:
- Is this widespread or isolated to one tenant/route/method?
- Is it a new regression (deploy-correlated) or a gradual degradation (resource/saturation)?
- Is it primarily errors or latency?
Start with RED for the boundary (HTTP route / gRPC method / consumer group).
4) Map failure propagation (technical + organizational)
- If this component degrades, what fails next?
- What is likely failing silently (data drift, dropped work, partial writes, stale reads)?
- What is the organizational cascade (handoff queue, approvals, unclear ownership)?
5) Decide: mitigate vs investigate
If impact is high and evidence points to a recent change:
- rollback / disable flag / reduce load / scale critical dependency
If impact is moderate or unclear:
- tighten the hypothesis with 1–2 targeted checks (another exemplar trace, compare two instances, check downstream health)
6) Capture learnings (don’t lose the fix)
If you found a systemic gap, capture it:
Guardrails
- Don’t log secrets/PII while triaging (even “temporarily”).
- Don’t use unbounded IDs as metric labels; use logs/traces for per-entity investigation.
- Don’t add retries as a debugging “fix” without idempotency/dedupe.
- Prefer a small number of exemplars (2–3) over “grep everything forever”.
References
Output Template
When using this skill, return:
- Symptom: what is failing/slow (include concrete ops: route/method/job/message type).
- Impact: who/what is affected and how badly (errors %, latency p95, backlog size).
- Time window: start/end and whether it correlates with deploy/config change.
- Evidence: exemplar IDs + the key log/trace/metric observations.
- Hypothesis: most likely cause + 1 alternative (if applicable).
- Failure propagation: what breaks next, what breaks silently, organizational cascade points.
- Mitigation: what you did / recommend doing now (rollback/flag/scale).
- Fix plan: code/config changes to make it correct and durable.
- Follow-ups: telemetry gaps, runbook updates, tests, new invariants.
1---2name: debug-413description: Triage and diagnose production or local issues by following logs → traces → metrics (HTTP/gRPC/async). Use when investigating errors, latency spikes, 5xx responses, SLO violations, or regressions in an instrumented app. NOT for adding new instrumentation (use observability); NOT for applying resilience patterns (use resilience).4---5
6# Debug (Log → Trace → Metrics)
7
8## Overview
9
10This skill is for **debugging** with existing telemetry. It does **not** focus on adding instrumentation (use `observability` when telemetry gaps block triage).
11
12Goal: turn “something is broken/slow” into:
13
14- a concrete **symptom + impact** statement,
15- an **evidence-backed hypothesis** (or a small set of competing ones),
16- a **mitigation** (rollback/flag/scale) when needed,
17- a short list of **fix + follow-up** tasks.
18
19## Workflow
20
21### 0) Establish ground truth (2–5 minutes)
22
23Capture:
24
25- Environment (`local`/`dev`/`staging`/`prod`) and time window (start/end).
26- Symptom (what’s failing/slow) and impact (SLO/user-visible blast radius).
27- One **exemplar**: request/trace ID, job run ID, message ID, or timestamped log line.
28
29### 1) Logs (find the exemplar and its correlation IDs)
30
311. Find the first error/timeout log line closest to the symptom window.
322. Identify correlation keys (prefer stable IDs):
33 - `traceId`, `requestId`, `spanId`
34 - `op` (route template / RPC method / job name / message type)
35 - error code/type (typed error envelope, gRPC status, HTTP status)
363. Pull the **full log story** for the exemplar (start → downstream call(s) → failure).
37
38Copy/paste helpers live in `references/commands.md`.
39
40### 2) Trace (turn the exemplar into a dependency hypothesis)
41
42If you have a `traceId`, use it.
43
441. Open the trace and confirm the root span matches the suspected operation (`op`).
452. Identify:
46 - the slowest span(s),
47 - the first error span(s),
48 - retries (multiple similar child spans),
49 - deadline/time budget signals (deadline exceeded, timeout errors).
503. Convert that to a dependency statement:
51 - “`service A` is timing out calling `service B` method `X`”
52 - “DB query `Y` is slow / missing index / deadlocked”
53 - “Queue consumer is failing on message type `T` (poison message)”
54
55If you cannot find/interpret traces, fall back to logs + metrics and consider adding missing telemetry via `observability`.
56
57### 3) Metrics (confirm blast radius + regression)
58
59Use metrics to answer:
60
61- Is this widespread or isolated to one tenant/route/method?
62- Is it a new regression (deploy-correlated) or a gradual degradation (resource/saturation)?
63- Is it primarily errors or latency?
64
65Start with RED for the boundary (HTTP route / gRPC method / consumer group).
66
67### 4) Map failure propagation (technical + organizational)
68
69- If this component degrades, what fails next?
70- What is likely failing silently (data drift, dropped work, partial writes, stale reads)?
71- What is the organizational cascade (handoff queue, approvals, unclear ownership)?
72
73### 5) Decide: mitigate vs investigate
74
75If impact is high and evidence points to a recent change:
76
77- rollback / disable flag / reduce load / scale critical dependency
78
79If impact is moderate or unclear:
80
81- tighten the hypothesis with 1–2 targeted checks (another exemplar trace, compare two instances, check downstream health)
82
83### 6) Capture learnings (don’t lose the fix)
84
85If you found a systemic gap, capture it:
86
87- missing telemetry field contracts → [`observability`](../observability/SKILL.md)
88- retries without idempotency / missing time budgets → [`resilience`](../resilience/SKILL.md)
89- repeated boundary logic across services → [`platform`](../platform/SKILL.md)
90- cross-service pattern confusion → [`architecture`](../architecture/SKILL.md)
91
92## Guardrails
93
94- Don’t log secrets/PII while triaging (even “temporarily”).
95- Don’t use unbounded IDs as metric labels; use logs/traces for per-entity investigation.
96- Don’t add retries as a debugging “fix” without idempotency/dedupe.
97- Prefer a small number of exemplars (2–3) over “grep everything forever”.
98
99## References
100
101- Copy/paste commands: [`references/commands.md`](references/commands.md)
102- Scenario checklists (HTTP/gRPC/consumers): [`references/scenarios.md`](references/scenarios.md)
103- Retrospective / Postmortem template: [`../references/structured-thinking-templates.md`](../references/structured-thinking-templates.md)
104- If telemetry is missing: [`observability`](../observability/SKILL.md)
105
106## Output Template
107
108When using this skill, return:
109
110- **Symptom**: what is failing/slow (include concrete ops: route/method/job/message type).
111- **Impact**: who/what is affected and how badly (errors %, latency p95, backlog size).
112- **Time window**: start/end and whether it correlates with deploy/config change.
113- **Evidence**: exemplar IDs + the key log/trace/metric observations.
114- **Hypothesis**: most likely cause + 1 alternative (if applicable).
115- **Failure propagation**: what breaks next, what breaks silently, organizational cascade points.
116- **Mitigation**: what you did / recommend doing now (rollback/flag/scale).
117- **Fix plan**: code/config changes to make it correct and durable.
118- **Follow-ups**: telemetry gaps, runbook updates, tests, new invariants.
119 - If root cause is systemic, flag for a follow-up retrospective ([`../references/structured-thinking-templates.md`](../references/structured-thinking-templates.md) — Retrospective / Postmortem).