Use case: A notification that says “Asset 1 is at 102% max speed. This began in zone B.”
An SQL query gets “select speed as value, time, asset_name, location_string…”, returning a single row for each unique asset_name, with its current speed & location_string.
My failed attempt: I created an annotation using {{ $labels.asset_name }}, {{ $values.A.speed }}, and {{ $labels.location_string }}, which works… But since every time it evaluates, labels.location_string is different, it “resolves” the initial alert instance and creates a new one.
This makes sense: Labels allow for multi-dimension alerts, I’m expecting that if an “Asset 2” row passes the threshold this will be considered a different alert instance.
But, I’m unsure how to get a string from the database without it being a “label” and counting as a new alert.
Grouping doesn’t help: After the fact we can use grouping to limit notifications, but this doesn’t fix the underlying problem, and you’ll still get an email with 20 of the same notification.
Using multiple queries doesn’t work: Note that $values.A.speed can change without creating a new alert instance, since of course the measured value will change. I think the correct solution would be to have one query for each value, with the same labels so the query results can be joined behind the scenes… But it appears you can’t have strings as values. I get this:
“[sse.readDataError] [D] got error: input data must be a wide series but got type not (input refid)”
I think I just need to alter the backend, so that it has a static “overspeed_location” that stays the same until even after the speed is below the threshold, just wanted to confirm I’m not missing anything. Appreciate any comments.