Skip to content
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

[v10.4.x] Alerting: Add "Keep Last State" backend functionality #84406

Merged
merged 1 commit into from
Mar 13, 2024

Conversation

grafana-delivery-bot[bot]
Copy link
Contributor

Backport 10dc6c6 from #83940


What is this feature?

This PR adds the backend functionality that emulates the "keep last state" feature from legacy alerting in Grafana managed alerting (GMA).

Setting either NoDataState or ExecutionErrorState to KeepLast will persist the previous state of the alert instance and set the state reason to a concatenation of the evaluation result and KeepLast, e.g. NoData, KeepLast. This will respect the pending period (for) of a rule, which in practice means that associated alert instances will move to the Alerting state if the Pending state is kept for long.

Some examples:

  • t0:[Normal] => [Normal], t1:[NoData] => [Normal], t2:[NoData] => [Normal]
  • with for=2 - t0:[Alerting] => [Pending], t1:[NoData] => [Pending], t2:[NoData] => [Alerting]

Why do we need this feature?

This allows users to avoid being notified of no data and error evaluations on their alert rules.

Who is this feature for?

Users of Grafana managed alerting.

Which issue(s) does this PR fix?:

Resolves #82585
Related to #77800

Special notes for your reviewer:

Please check that:

  • It works as expected from a user's perspective.
  • If this is a pre-GA feature, it is behind a feature toggle.
  • The docs are updated, and if this is a notable improvement, it's added to our What's New doc.

* Implement keep last state for state transitions

* Respect For duration when keeping state

* Only keep transition from recording an annotation

* Add keep last state option for nodata/error in UI

(cherry picked from commit 10dc6c6)
@grafana-delivery-bot grafana-delivery-bot bot requested review from a team as code owners March 13, 2024 19:07
@grafana-delivery-bot grafana-delivery-bot bot requested a review from a team March 13, 2024 19:07
@grafana-delivery-bot grafana-delivery-bot bot added this to the 10.4.x milestone Mar 13, 2024
@grafana-delivery-bot grafana-delivery-bot bot requested review from Clarity-89 and JoaoSilvaGrafana and removed request for a team March 13, 2024 19:07
@grafana-delivery-bot grafana-delivery-bot bot added add to changelog area/alerting Grafana Alerting area/alerting/migration Issues relating to legacy alerting migration area/backend area/frontend backport A backport PR product-approved Pull requests that are approved by product/managers and are allowed to be backported labels Mar 13, 2024
@rwwiv rwwiv merged commit 335aa31 into v10.4.x Mar 13, 2024
24 checks passed
@rwwiv rwwiv deleted the backport-83940-to-v10.4.x branch March 13, 2024 19:23
@mdvictor mdvictor modified the milestones: 10.4.x, 10.4.1 Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add to changelog area/alerting/migration Issues relating to legacy alerting migration area/alerting Grafana Alerting area/backend area/frontend backport A backport PR product-approved Pull requests that are approved by product/managers and are allowed to be backported
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants