-
Notifications
You must be signed in to change notification settings - Fork 561
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Alertmanager: Initialize skipped Grafana Alertmanagers receiving requests #10691
Open
santihernandezc
wants to merge
7
commits into
main
Choose a base branch
from
santihernandezc/initialize_skipped_grafana_alertmanagers_receiving_requests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Alertmanager: Initialize skipped Grafana Alertmanagers receiving requests #10691
santihernandezc
wants to merge
7
commits into
main
from
santihernandezc/initialize_skipped_grafana_alertmanagers_receiving_requests
Conversation
This file contains 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
💻 Deploy preview available: https://deploy-preview-mimir-10691-zb444pucvq-vp.a.run.app/docs/mimir/latest/ |
santihernandezc
commented
Feb 20, 2025
@@ -104,7 +104,6 @@ type Config struct { | |||
PersisterConfig PersisterConfig | |||
|
|||
GrafanaAlertmanagerCompatibility bool | |||
GrafanaAlertmanagerTenantSuffix string |
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.
Unrelated fix, this was not being used here.
tacole02
approved these changes
Feb 21, 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.
Docs look great! Thank you!
…mestamp for tenants not yet in the receivingRequests map
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
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.
Description
If the
grafana_alertmanager_conditionally_skip_tenant_suffix
option is configured and a Grafana Alertmanager tenant doesn't have a promoted, non-default, non-empty configuration, we skip initializing it.The problem is that clients making requests against an uninitialized Alertmanager get
406
s. Unless a Grafana Alertmanager has a "usable" configuration, users won't be able to test templates, test and get receivers, create silences, etc.This PR makes the multi-tenant Alertmanager start per-tenant Grafana Alertmanagers on incoming requests. This way, requests can be handled even if tenants were initially skipped.
It also adds a grace period for idle Alertmanagers. Whenever a skipped Alertmanager gets a request, we start the Alertmanager and keep a timestamp indicating when this request was received. After the grace period elapses, we shut down the Alertmanager.
Testing
I tested this PR by spinning up two Alertmanagers (read-write mode) with:
multitenancy_enabled: true
grafana_alertmanager_compatibility_enabled: true
grafana_alertmanager_conditionally_skip_tenant_suffix: -grafana
I then created 200 Alertmanager tenants with empty configurations:
The 99 tenants with empty configuration and matching the suffix were initially skipped. I then sent test alerts for each tenant matching the suffix. Alertmanagers for each of them were started.
After the default grace period passed, all Alertmanagers for tenants matching the configured suffix were stopped, except the one using a promoted, non-default, non-empty configuration.
Query for tenants skipped per instance
Query for active Alertmanagers by type (Mimir/Grafana)