Diagnostics¶
How to see, attribute, and respond to what's happening inside a running program — language-agnostic principles, with concrete examples in languages/.
Sections¶
The original three¶
- Debugging — interactive debuggers, post-mortem analysis, core dumps, time-travel debugging, when prints beat breakpoints.
- Logging — levels, structured logs, correlation IDs, log volume vs signal, sampling, retention.
- Error Handling — exceptions vs result types, sentinel errors, error wrapping, stack traces, recovery vs propagation.
Observability pillars (the rest of the triangle)¶
- Metrics — counters, gauges, histograms; cardinality; Four Golden Signals / RED / USE; OpenTelemetry Metrics SDK.
- Tracing — spans, context propagation, OpenTelemetry SDK, sampling; tying traces to logs and metrics.
Production diagnostics¶
- Crash Reporting — Sentry / Crashlytics / Bugsnag flows; symbolication, deduplication, release tagging.
- Diagnostic Endpoints —
/debug/pprof, JMX, JFR, health / readiness probes, in-process REPLs, runtime config toggles. - Panic & Recovery — invariant violations, unwinding, signals, "let it crash," recover-at-boundary patterns.
- Post-Mortem Analysis — core dumps, heap dumps, thread / goroutine dumps, JFR recordings, offline reproduction.
- Audit Logging — security- and compliance-grade logs; tamper-evidence, retention, sampling-forbidden discipline; separation from operational logs.
Related¶
- Quality Engineering › Performance › Profiling — CPU / memory / allocation profiling lives there; the diagnostic surfaces that expose profiles live in Diagnostic Endpoints.
- Quality Engineering › Performance — when diagnostics is profiling.
- Code Craft › Clean Code › Error Handling — the source-level discipline.
- Code Craft › Clean Code › Logging & Diagnostics — the source-level discipline for emitting diagnostic data.
- Language Internals — knowing how the runtime works makes diagnostics tractable.
- Backend › Observability — the system-level observability stack (storage, dashboards, alerting); this section is the language-level discipline that feeds it.
- Backend › Distributed Systems › Distributed Tracing — collector topology and end-to-end design that this section's Tracing feeds into.