Hi, I am trying to configure a multi-dimensional alert rule with Infinity data source on Grafana v11.0.0.
I need to call an API to get energy of multiple entity ids. I set the time range as 1 day. So, if the time interval is “1d”, there will be only 1 data point returned for each entity id. If I set the time range as “1h”, there will be 24 data points returned for each entity id.
My goal is to query energy with multiple entity ids. If the daily average energy of an entity id is larger than, for example, 100, the alert rule should fire for that entity id.
In my example, I query with two entity ids: 532, and 628. The interval is “1d”, so there is only 1 data point for each entity id, and now there are totally two data points because I query with two entity ids. The output of the API call is:
[
{
"id": 532,
"timestamp": "2024-08-09T06:00:00Z",
"energy": 30240091.382400632
},
{
"id": 628,
"timestamp": "2024-08-09T06:00:00Z",
"energy": 45192935.26953125
}
]
To the best of my knowledge, we should use group by id
so that grafana can treat each id as a different data stream and thus we can create a multi-dimensional alert rule (please correct me if this understanding is wrong. I learned from other community posts although they use Prometheus data source, not Infinity data source). But, it turns out that my configuration does not work.
From the snapshot below, there are 2 series for the “Mean Energy”:
- Series 1: 37716513 → this is the mean energy when we consider both entity ids as a group. This is not what I intend to do. 37716513 = (30240091 + 45192935) / 2
- Series 2: 580 → this is the mean entity id when we consider both entity ids as a group. But, the mean entity ids does not make sense to me. I don’t want to average entity ids. 580 = (532 + 628) / 2 = 580
Instead, what I expect is:
- Series 1: 30240091 → mean energy for entity id 532
- Series 2: 45192935 → mean energy for entity id 628
Anyone who knows how to adjust the configuration correctly to achieve my goal? Thanks.