1

I'm trying to build a composite metric which displays the count of sources reporting for a metric, and alert on it (for example if the number of source count is less than 3). Is this possible?

Kevin
  • 11
  • 1

1 Answers1

1

Yes, it's possible. It's a little convoluted right now and we will make it simpler in the future, but this will work:

sum(
    map({source:"*"},
        divide([
            series("my_metric","&"),
            series("my_metric","&")
        ])
    )
)

Here's a quick explanation:

The map() function breaks out all of the metric's sources (by using the * wildcard). I'm dividing the metric by itself to get a 1 for each instance and all that is wrapped in the sum() function to add it up.

Nik
  • 39
  • 1
  • 6