grafana / grafana

The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
https://grafana.com
GNU Affero General Public License v3.0
64.62k stars 12.09k forks source link

Ability to retrieve evaluation value from Threshold expression #82566

Open gelicia opened 8 months ago

gelicia commented 8 months ago

Discussed in https://github.com/grafana/grafana/discussions/73288

Originally posted by **gtirloni** August 15, 2023 Through the `$values` variable, we are able to access the result of all the queries/expressions in an alert. However, we are not able to retrieve the actual value defined in a Threshold expression. Only the result (one or zero) is visible. It would be useful to have the actual evaluation value from a Threshold expression so we can use it in a template (e.g. to dynamically define a summary that goes to the notification).
grobinson-grafana commented 6 months ago

Discussed with the team, we are considering introducing variables into the rule definition that could then be used in both the expressions (such as Threshold) and the annotation templates. We think this would address this use case, but we haven't committed to building this for the time being.