Measure Every API Call in Your Go App in 30 Lines of Code

I recently gave a talk at GrafanaCon LA, which was heavily inspired by my blog post on . During the talk, I dove into a popular monitoring use case with Sensu, InfluxDB, and Grafana — let's call it the SIG stack. While I got to share some awesome features in Sensu that ultimately allow users to collect, store, and visualize their metrics, the conference was about Grafana, and folks wanted to see dashboards! Now, I'm a Go dev, not a data scientist, so I don't have quick access to large sample sets, and while it's super easy to spin up Sensu in production and start scraping nodes to collect fancy metrics, I wanted something more... and the attendees of GrafanaCon wanted something moar!

StatsD

Enter StatsD, the OG metric aggregator that — over the years — has become an industry standard. It's a simple and lightweight daemon that can aggregate custom performance data. StatsD client libraries are ubiquitous and available in just about every language, so you can instrument the tooling in your app's native language and send those metrics off to a StatsD server. Fortunately for you, every Sensu agent has an embedded StatsD server that listens for UDP traffic on port 8125. Since UDP is a "fire-and-forget" protocol, it minimizes performance impact and risk when implementing it in your code.