Skip to content

feat: add withLabels function to utils for enhanced rule labeling #1459

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

andriikushch
Copy link

This PR adds a new utility function withLabels() to the mixin-utils library that allows adding labels to alert rules.

Features

  • Add labels to all alerts in rule groups
  • Optionally filter which alerts receive the labels using a custom filter function
  • Preserves existing labels on alerts

Usage example:

local utils = import 'mixin-utils/utils.libsonnet';

// Add environment and team
local alertGroups = [...];
local withEnvironment = utils.withLabels(
  { environment: 'production', team: 'myteam' },
  alertGroups
);
Copy link
Contributor

@tristanburgess tristanburgess left a comment

Choose a reason for hiding this comment

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

nice work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants