Skip to content

deployment/docker: Add alerting rules#1

Merged
makasim merged 5 commits into
mainfrom
cardinality-alerts
Jun 27, 2026
Merged

deployment/docker: Add alerting rules#1
makasim merged 5 commits into
mainfrom
cardinality-alerts

Conversation

@makasim

@makasim makasim commented Jun 25, 2026

Copy link
Copy Markdown
Member

No description provided.

@makasim makasim requested review from Haleygo and hagen1778 June 25, 2026 16:45
@makasim makasim self-assigned this Jun 25, 2026
annotations:
# todo: add link to dashboard
summary: "High cardinality for job {{ $labels.by_job }}"
description: "Job {{ $labels.by_job }} has {{ $value }} active series over the last {{ $labels.interval }}, exceeding the 5000 series threshold."

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ActiveSeries is VM-related term, other DBs may not have it. Just say "cardinality" or "number of unique series"

Comment on lines +17 to +23
- alert: 'Cardinality10xWithin1h'
expr: |
(
max without(job, instance) (cardinality_estimate{group_by_keys!="__global__",group_by_keys!="__group__"})
/
max without(job, instance) (cardinality_estimate{group_by_keys!="__global__",group_by_keys!="__group__"} offset 1h)
) > 10

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I'd avoid x10 and x24 like alerts, as they're very specific to environment and selected time interval.

What I would like to know whether cardinality grows over time. That can be measured with deriv but you have to account for multiple things:

  1. Daily or seasonal patterns - cardinality can grow and shring during the day. The daily growth should be accounted in a formula
  2. A burst-like spike in cardinality growth

So I'd suggest something like:


(deriv(cardinality_estimate[1h]) > burst_threshold
and 
deriv(cardinality_estimate[5m]) > burst_threshold)
or
(deriv(cardinality_estimate[6h]) > low_threshold
and 
deriv(cardinality_estimate[30m]) > low_threshold)

Additionally you might want to look at https://prometheus.io/blog/2015/06/18/practical-anomaly-detection/

The general idea behind it is to detect cardinality growth on short and long ranges.

@makasim makasim merged commit 7dbe1f3 into main Jun 27, 2026
@makasim

makasim commented Jun 28, 2026

Copy link
Copy Markdown
Member Author

Merged by accident, reopned in #2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants