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: Fix migration to not add label "alertname" #56509

Merged

Conversation

yuri-tceretian
Copy link
Contributor

@yuri-tceretian yuri-tceretian commented Oct 6, 2022

What this PR does / why we need it:
The migration from legacy to the new Grafana Alerting adds a label alertname to the rule. That label gets overridden by the state manager when it calculates the state because the label is reserved. The state manager emits a warning log when there are labels that are overridden. This creates an avalanche of warning logs.

This PR updates migration to not add the label (because it is overridden anyway).
Also, it updates state manager logic to compare values of the same label and to emit a warning only if values are different.

Which issue(s) this PR fixes:

Fixes #55670

Special notes for your reviewer:

because it is overridden in state manager anyway
@yuri-tceretian yuri-tceretian added area/alerting Grafana Alerting add to changelog backport v9.1.x Bot will automatically open backport PR backport v9.2.x Mark PR for automatic backport to v9.2.x labels Oct 6, 2022
@yuri-tceretian yuri-tceretian added this to the 9.1.8 milestone Oct 6, 2022
@yuri-tceretian yuri-tceretian self-assigned this Oct 6, 2022
@yuri-tceretian yuri-tceretian requested a review from a team as a code owner October 6, 2022 21:07
@yuri-tceretian yuri-tceretian merged commit e2f1201 into grafana:main Oct 7, 2022
@yuri-tceretian yuri-tceretian deleted the migration-alertname-label branch October 7, 2022 19:06
@grafanabot
Copy link
Contributor

The backport to v9.1.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new branch
git switch --create backport-56509-to-v9.1.x origin/v9.1.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x e2f1201382a2f0ada82677ba243213dce4be6ca8
# Push it to GitHub
git push --set-upstream origin backport-56509-to-v9.1.x
git switch main
# Remove the local backport branch
git branch -D backport-56509-to-v9.1.x

Then, create a pull request where the base branch is v9.1.x and the compare/head branch is backport-56509-to-v9.1.x.

@grafanabot
Copy link
Contributor

The backport to v9.2.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new branch
git switch --create backport-56509-to-v9.2.x origin/v9.2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x e2f1201382a2f0ada82677ba243213dce4be6ca8
# Push it to GitHub
git push --set-upstream origin backport-56509-to-v9.2.x
git switch main
# Remove the local backport branch
git branch -D backport-56509-to-v9.2.x

Then, create a pull request where the base branch is v9.2.x and the compare/head branch is backport-56509-to-v9.2.x.

yuri-tceretian added a commit to yuri-tceretian/grafana that referenced this pull request Oct 7, 2022
* do not add label alertname because it is overridden in state manager anyway
* update state manager to not consider labels with same value as dupe

(cherry picked from commit e2f1201)

# Conflicts:
#	pkg/services/ngalert/state/cache.go
yuri-tceretian added a commit to yuri-tceretian/grafana that referenced this pull request Oct 7, 2022
* do not add label alertname because it is overridden in state manager anyway
* update state manager to not consider labels with same value as dupe

(cherry picked from commit e2f1201)

# Conflicts:
#	pkg/services/ngalert/state/cache.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add to changelog area/alerting Grafana Alerting area/backend/db/migration area/backend backport v9.1.x Bot will automatically open backport PR backport v9.2.x Mark PR for automatic backport to v9.2.x
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

9.1.6 warn - rule declares one or many reserved labels. Those rules labels will be ignored
3 participants