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

Alerting: Choose a previous valid AM configuration in case of error #65746

Merged
merged 21 commits into from
Apr 5, 2023

Conversation

VikaCep
Copy link
Contributor

@VikaCep VikaCep commented Mar 31, 2023

What is this feature?

This PR is based on the backend work from #65728 and displays a dropdown with valid AM configurations when the current configuration is invalid so that the user can then choose one from the list to start their Alertmanager.

Why do we need this feature?

Currently if the Alertmanager fails to start, an error message is displayed and the user is basically locked out of Grafana Alerting. A lot of safeguards were added in order to avoid having bad configs saved in the database, but it's impossible to take into account each and every edge case, so this feature works as a sort of "escape hatch".

How will this work?

When there's an invalid configuration, the user is shown an error message and prompted to choose from a list of old, valid configurations

IMPORTANT NOTE: All commits until 1a91808 have been cherry-picked from #59516 which was already approved. The referenced PR was closed because the backend branch it was based off was closed and reimplemented in a new one.
Last 4 commits are new and they address the following changes that are worth to be mentioned:

  • Upon selecting an old configuration, users won't be able to edit it any longer. For this reason the textarea is disabled. Instead, the current configuration will be replaced with the exact content of the selected option in the list.
  • A new endpoint (POST /api/alertmanager/grafana/config/history/<id>/_activate) has been added for this scenario. When the reset button is clicked it gets called passing the old configuration id.

Fixes #54505

image

2023-04-02 14 00 25

Due to the latest backend changes, we no longer will provide the option to edit previous AM configurations in a textearea.
Instead users will only be allowed to reset to a specific one with the same content. For this reason the textearea for old conf
igurations is disabled and a different form action (not submit) is executed on the "reset config" button. The updateAlertManage
rConfigAction is reset to its old functionality due to these changes.
@VikaCep VikaCep force-pushed the alerting/reset-to-previous-am-configurations branch from 0392c4f to cba7703 Compare March 31, 2023 21:14
@github-advanced-security
Copy link

You have successfully added a new CodeQL configuration .github/workflows/pr-codeql-analysis-javascript.yml:analyze. As part of the setup process, we have scanned this repository and found 27 existing alerts. Please check the repository Security tab to see all alerts.

@VikaCep VikaCep force-pushed the alerting/reset-to-previous-am-configurations branch from 69eb0d0 to 2b8ae89 Compare March 31, 2023 22:05
@VikaCep VikaCep marked this pull request as ready for review April 2, 2023 16:14
@VikaCep VikaCep requested a review from a team as a code owner April 2, 2023 16:14
@VikaCep VikaCep requested a review from a team April 2, 2023 16:14
Copy link
Member

@soniaAguilarPeiron soniaAguilarPeiron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Great job! 🎉

Copy link
Member

@gillesdemey gillesdemey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few nits / suggestions.

Code LGTM! 🚀

Copy link
Contributor

@konrad147 konrad147 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@grafanabot
Copy link
Contributor

This pull request was removed from the 9.5.0 milestone because 9.5.0 is currently being released.

@grafanabot grafanabot removed this from the 9.5.0 milestone Apr 4, 2023
@VikaCep VikaCep added this to the 10.0.0 milestone Apr 5, 2023
@VikaCep VikaCep merged commit f27326f into main Apr 5, 2023
@VikaCep VikaCep deleted the alerting/reset-to-previous-am-configurations branch April 5, 2023 18:13
@zerok zerok modified the milestones: 10.0.0, 10.0.0-preview May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Alerting: users should always be able to edit broken alertmanager configuration.
6 participants