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: Migration to fix rule group name to not contain slashes + make all groups unique #65662

Closed
wants to merge 5 commits into from

Conversation

yuri-tceretian
Copy link
Contributor

What is this feature?
When Grafana migrates rules from legacy alerting it creates a new rule with title and group name taken from the legacy alert title. There are no restrictions on the rule title in the legacy alerting but there are constraints for the rule group in the new alerting: the name cannot contain forward or backward slashes
image

This PR fixes migration to normalize group name and replaces slashes with _.
This can cause another problem - two rules with names like rule1 // test and rule1 /\ test will end up in the same group rule1 __ test and if rules have different evaluation intervals, the evaluation interval of one rule will override another. Also, it brakes the contract that during migration a rule is placed in its own group.

To make sure that all groups are unique, this PR updates migration to check all rules in the organization for the uniqueness of the group. If group name is not unique, it is modified by appending rule UID at the end of the name (if the concatenated string is longer than the maximum limit of 190 symbols, the group name gets truncated to fit the full UID).

Related: #55670 (comment)

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.
  • There are no known compatibility issues with older supported versions of Grafana, or plugins.
  • It passes the Hosted Grafana feature readiness review for observability, scalability, performance, and security.

@yuri-tceretian yuri-tceretian added area/alerting Grafana Alerting area/alerting-legacy Legacy dashboard alerts, deprecated since 9.0 no-backport Skip backport of PR no-changelog Skip including change in changelog/release notes labels Mar 30, 2023
@yuri-tceretian yuri-tceretian added this to the 9.5.0 milestone Mar 30, 2023
@yuri-tceretian yuri-tceretian requested a review from a team as a code owner March 30, 2023 22:52
@yuri-tceretian yuri-tceretian self-assigned this Mar 30, 2023
@yuri-tceretian yuri-tceretian force-pushed the yuri-tceretian/migration-slash-name branch from 9ca2368 to 2da8281 Compare March 31, 2023 18:21
@grafanabot grafanabot removed this from the 9.5.0 milestone Apr 4, 2023
@grafanabot
Copy link
Contributor

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

@grafanabot
Copy link
Contributor

This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 2 weeks if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@grafanabot grafanabot added stale Issue with no recent activity and removed stale Issue with no recent activity labels May 5, 2023
@yuri-tceretian yuri-tceretian marked this pull request as draft May 8, 2023 15:24
@yuri-tceretian yuri-tceretian force-pushed the yuri-tceretian/migration-slash-name branch from 2da8281 to 8baa0a7 Compare May 12, 2023 20:12
@yuri-tceretian yuri-tceretian marked this pull request as ready for review May 15, 2023 13:26
@yuri-tceretian
Copy link
Contributor Author

We discussed this, and decided to not merge it because:

  1. we plan to support slashes in the future
  2. this does not cause the migration fail, and can be fixed by user on the next save.

@yuri-tceretian yuri-tceretian deleted the yuri-tceretian/migration-slash-name branch May 23, 2023 20:23
@github-actions github-actions bot removed this from the 10.0.x milestone May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/alerting Grafana Alerting area/alerting-legacy Legacy dashboard alerts, deprecated since 9.0 area/backend/db/migration area/backend no-backport Skip backport of PR no-changelog Skip including change in changelog/release notes type/bug
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants