-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Alerting: Add state history backend to write ALERTS metric #104361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0030f5d
to
01a9829
Compare
b46d8fb
to
4a41ed7
Compare
fec8435
to
28ddfe0
Compare
0f3aa40
to
706f805
Compare
1273b27
to
c065846
Compare
656c843
to
fc35318
Compare
fc35318
to
c4fa287
Compare
/deploy-to-hg |
|
|
This is a very neat approach, I like it, will review properly shortly |
stevesg
approved these changes
Jun 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
3 tasks
1 task
This was referenced Jun 20, 2025
m88deng
pushed a commit
to m88deng/grafana
that referenced
this pull request
Jun 30, 2025
…04361) **What is this feature?** This PR implements a new Prometheus historian backend that allows Grafana alerting to write alert state history as Prometheus-compatible `ALERTS` metrics to remote Prometheus-compatible data sources. The metric includes a few additional labels: * `grafana_alertstate`: Grafana's full alert state, more granular than Prometheus. * `grafana_rule_uid`: Grafana's alert rule UID. Grafana states are included in the `grafana_alertstate` label also mapped to Prometheus-compatible `alertstate` values: | Grafana alert state | `alertstate` | `grafana_alertstate` | |---------------------|-----------------------|-----------------------| | `Alerting` | `firing` | `alerting` | | `Recovering` | `firing` | `recovering` | | `Pending` | `pending` | `pending` | | `Error` | `firing` | `error` | | `NoData` | `firing` | `nodata` | | `Normal` | _(no metric emitted)_ | _(no metric emitted)_ |
YannickAlex07
pushed a commit
to YannickAlex07/grafana
that referenced
this pull request
Jul 11, 2025
…04361) **What is this feature?** This PR implements a new Prometheus historian backend that allows Grafana alerting to write alert state history as Prometheus-compatible `ALERTS` metrics to remote Prometheus-compatible data sources. The metric includes a few additional labels: * `grafana_alertstate`: Grafana's full alert state, more granular than Prometheus. * `grafana_rule_uid`: Grafana's alert rule UID. Grafana states are included in the `grafana_alertstate` label also mapped to Prometheus-compatible `alertstate` values: | Grafana alert state | `alertstate` | `grafana_alertstate` | |---------------------|-----------------------|-----------------------| | `Alerting` | `firing` | `alerting` | | `Recovering` | `firing` | `recovering` | | `Pending` | `pending` | `pending` | | `Error` | `firing` | `error` | | `NoData` | `firing` | `nodata` | | `Normal` | _(no metric emitted)_ | _(no metric emitted)_ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is this feature?
This PR implements a new Prometheus historian backend that allows Grafana alerting to write alert state history as Prometheus-compatible
ALERTS
metrics to remote Prometheus-compatible data sources.The metric includes a few additional labels:
grafana_alertstate
: Grafana's full alert state, more granular than Prometheus.grafana_rule_uid
: Grafana's alert rule UID.Grafana states are included in the
grafana_alertstate
label also mapped to Prometheus-compatiblealertstate
values:alertstate
grafana_alertstate
Alerting
firing
alerting
Recovering
firing
recovering
Pending
pending
pending
Error
firing
error
NoData
firing
nodata
Normal
Configuration
The backend can be enabled in the configuration file. For example:
Because the prometheus backend does not support querying, it will fail when it is configured as a primary backend.
Or together with Loki state history:
Example:
Please check that: