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

Implement regex exclusions for alerts #138

Merged
merged 1 commit into from Feb 8, 2021
Merged

Conversation

stefanprodan
Copy link
Member

@stefanprodan stefanprodan commented Feb 8, 2021

This PR adds a option field called exclusionList to the Alert API.

Fix: #137

Example usage

Skip alerting if the message matches a golang regex from the exclusion list:

apiVersion: notification.toolkit.fluxcd.io/v1beta1
kind: Alert
metadata:
  name: flux-system
  namespace: flux-system
spec:
  providerRef: 
    name: on-call-slack
  eventSeverity: error
  eventSources:
    - kind: GitRepository
      name: flux-system
  exclusionList:
    - "waiting.*socket"

The above definition will not send alerts for transient Git clone errors like:

unable to clone 'ssh://git@ssh.dev.azure.com/v3/...', error: SSH could not read data: Error waiting on socket

api/v1beta1/alert_types.go Outdated Show resolved Hide resolved
internal/server/event_handlers.go Show resolved Hide resolved
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
@stefanprodan stefanprodan merged commit 8ccdc94 into main Feb 8, 2021
@stefanprodan stefanprodan deleted the alert-exclusionList branch February 8, 2021 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/alerting Alerting related issues and PRs enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exclude messages from alerting
2 participants