Skip to main content
blog.philz.dev

Counting the number of lines in a monitoring system

Timeseries observability systems (like Datadog) are all a bit weird. If you have, say, 30 hosts, and each spits out its CPU usage as a metric, it's kinda hard to ask Datadog how many hosts you have. A simple way of doing this is to sum the series and divide by the average. Voila, you get the count. This doesn't work for metrics that can sum to zero, naturally.

Here's an example on Grafana: