z-go-observability
Installation
SKILL.md
Go Observability
Quick Reference
| Signal | Question | Tool | Gotcha |
|---|---|---|---|
| Logs | What happened? | log/slog |
Log OR return, never both |
| Metrics | How much / how fast? | prometheus/client_golang |
Never use unbounded label values |
| Traces | Where did time go? | OpenTelemetry SDK | Must propagate ctx everywhere |
| Profiles | Why slow/OOM? | net/http/pprof, Pyroscope |
Gate behind auth in production |
| Alerts | Is it broken now? | Prometheus + alertmanager | Use rate() not irate() for SLOs |
Logging
Use log/slog (Go 1.21+). Static message, dynamic data in key-value attrs.
slog.InfoContext(ctx, "order placed", "order_id", orderID, "total", total)
slog.Error("payment failed", "err", err, "order_id", id)