How to check if a timeseries is all 0?


#1

Hi

What’s the fastest way to check if a timeseries is all 0?

I was intending to check for ts.optimizedData().length == 1 && ts.optimizedData()[0] == 0 but for some of my metrics that return a 0-timeseries, ts.optimizedData() is a large array of 0 (instead of being a single value array).

Next strategy could be to check ts.aggregate('SUM').optimizedData()[0] (my series is >= 0) or directly iterate through ts.optimizedData() and check each value, but those don’t sound too optimal or very elegant.

Do you have anything else in mind?

Thanks