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: In migration, create one label per channel #76527

Merged
merged 8 commits into from Dec 19, 2023

Commits on Dec 18, 2023

  1. In migration, create one label per channel using UID instead of name

    Previously, we used the notification channel names to create the routing labels
    on an alert rule. This makes future work to individually re-migrate
    single channels difficult as channel names can be easily changed and are not
    guaranteed unique by any db constraint.
    
    This change modifies the logic to instead use the channel uid, which is
    guaranteed unique per org at the db level and is significantly less likely to
    change (indeed even if it does change, we can likely assume that the new channel
     is not equal in identity to the old one).
    
    In addition, we move away from a single `__contact__` label with an array of
    receiver names combined with regex-based route matching to multiple
    `__contact_{uid}__` labels and a simple equality-based route matching. These
    routes are now all nested under a single top-level route matched against
    `__use_legacy_channels__ = true` for ease of organization.
    
    This is done to improve the experience for users wanting to keep the
    default migrated routing strategy but modify which contact points an alert
    sends to. Editing the array could be difficult when large.
    
    This has the added benefit of great simplifying the logic around contact point
    migration as well and removes the (now unnecessary) DashAlert wrapper for
     legacymodels.Alert.
    JacobsonMT committed Dec 18, 2023
    Copy the full SHA
    57c55d3 View commit details
    Browse the repository at this point in the history
  2. Address PR review comments

    JacobsonMT committed Dec 18, 2023
    Copy the full SHA
    2642ae1 View commit details
    Browse the repository at this point in the history
  3. Copy the full SHA
    36719bd View commit details
    Browse the repository at this point in the history
  4. Copy the full SHA
    a959711 View commit details
    Browse the repository at this point in the history
  5. Copy the full SHA
    4a69987 View commit details
    Browse the repository at this point in the history
  6. Copy the full SHA
    79bbacf View commit details
    Browse the repository at this point in the history
  7. Fix rebase conflict

    JacobsonMT committed Dec 18, 2023
    Copy the full SHA
    ac05217 View commit details
    Browse the repository at this point in the history
  8. Fix linting

    JacobsonMT committed Dec 18, 2023
    Copy the full SHA
    218cd04 View commit details
    Browse the repository at this point in the history