Are You Testing Your Observability? Patterns for Instrumenting Your Go Services
summary
Shows how to add concrete Prometheus metrics to a Go HTTP reverse proxy, including counter and histogram code snippets using Prometheus client_golang, exposes /metrics, and demos scraping with Prometheus to plot requests per minute and error counts. Replaces global metrics with a custom Registry and per-instance structs to avoid name clashes. Demonstrates unit-test assertions that catch a buggy recorder, explains histogram bucket tuning, cardinality limits, and initializing series so alerts actually fire.
AI-written summary · about
chapters (11)
- 0:00Introduction and speakers
- 1:50Why instrument Go services
- 6:25Adding metrics in Go
- 11:11Avoiding global state pitfalls
- 16:49Testing metrics properly
- 23:22Consistency with RED method
- 25:49Naming conventions for metrics
- 28:41Cardinality and labels
- 31:11Histogram bucket pitfalls
- 35:27Initializing metrics
- 37:13Key takeaways and summary
