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

feat(alerting): detect flapping alerts #148

Open
wants to merge 1 commit into
base: feat/up-alert
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/prometheus_alert_rules/flapping.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
groups:
- name: AlertRules
rules:
- alert: AlertRulesFlapping
expr: changes(ALERTS_FOR_STATE{severity = "warning"}[1h]) > 5
Copy link
Contributor

Choose a reason for hiding this comment

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

TIL!
Apparently there also ALERTS, but the value there is "1", whereas for ALERTS_FOR_STATE it's timestamp.
How did you find out this exists?

Copy link
Member Author

Choose a reason for hiding this comment

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

Through @err404r :)

Copy link

Choose a reason for hiding this comment

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

ALERTS is not working with changes for some reason, when I found this out I google and find out about ALERTS_FOR_STATE it is internal metrics which is used to track alert state in between prometheus restarts. According to official docs

Copy link
Contributor

Choose a reason for hiding this comment

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

Would we need to replicate the alert per severity?

for: 5m
simskij marked this conversation as resolved.
Show resolved Hide resolved
labels:
severity: warning
annotations:
summary: Host '{{labels.instance}}' suffers from flapping alerts.
simskij marked this conversation as resolved.
Show resolved Hide resolved
description: >-
Host '{{labels.instance}}' suffers from flapping warning-level alerts.
VALUE = {{ $value }}
LABELS = {{ $labels }}