Infinity Datasource plugin: Reduce not working correctly in Alerting

I am using the Infinity DataSource plugin. My dataset consists of multiple time series combined into a single structure, which looks like this.

[
  {
    "timestamp": 1718613617621,
    "value": 9.691442,
    "name": "AAA"
  },
  {
    "timestamp": 1718614018788,
    "value": 9.306188,
    "name": "AAA"
  },
  {
    "timestamp": 1718613848344,
    "value": 20.296214,
    "name": "BBB"
  },
  {
    "timestamp": 1718614207304,
    "value": 23.544085,
    "name": "BBB"
  },
]

Following the advice from Infinity Datasource plugin dashboard with multiple timeseries data I was able to successfully plot the data on the dashboard. However, the alerting mechanism is not functioning as expected.

When setting up alerting, my data source does not recognize the query as multiple time series data (even though the query is correctly duplicated from my dashboard). I need to trigger alerts for time series where the value exceeds zero, and as seen in the data, there are two such cases. However, when using Last as the Reduce function, it selects the last value from the entire dataset based on time, rather than the last value of each individual time series.

When using Strict mode, alerts are triggered for all time series.

Min and Max functions are also not helpful, as they select the overall minimum or maximum value of the series rather than the last values.

What would be the correct approach to handling this issue? Any guidance would be greatly appreciated.

This is not reduce expression problem but the data source. There is a specific format of data that Grafana server-side expressions expect. It seems that it does not follow it. I would recommend asking in the Github repository dedicated to the data source

Thanks :armenia:
Fixed by adding summarization at the query level in the alert.

1 Like