Skip to content

fix(alerts): the rules no longer evaluate in one herd - #378

Merged
rldyourmnd merged 1 commit into
mainfrom
fix/alerts-do-not-evaluate-in-one-herd
Sep 2, 2026
Merged

fix(alerts): the rules no longer evaluate in one herd#378
rldyourmnd merged 1 commit into
mainfrom
fix/alerts-do-not-evaluate-in-one-herd

Conversation

@rldyourmnd

Copy link
Copy Markdown
Contributor

The alert channel has been repeating the same page every ten minutes for hours, and alert_evaluation_failed has been firing without a broken rule behind it. Both have one cause.

OpenObserve snaps an aligned alert's next run to the previous interval boundary for its frequency (TriggerCondition::get_aligned_next_trigger_time), so with align_time: true every one-minute rule evaluates at :00 and every ten-minute rule at :00, :10, :20 — thirty-four alerts issuing their searches and persisting their group states in the same millisecond.

Measured on the live services host:

  • the simultaneous searches queue (metrics->search: wait in queue, all at the same timestamp) until some exceed the PromQL load-data timeout — that is what raised alert_evaluation_failed, sixteen times in two minutes, with each failing expression completing in 40–57 ms when run alone
  • the state writes queue behind SQLite's single serialised writer until they are refused: could not persist group states ...: database is locked, 2386 times in one day, about 190 an hour, peaking on the ten-minute boundaries
  • a scheduler that cannot persist that it already notified notifies again on the next tick, which is exactly the repetition in the channel's history

The host is not short of anything: load over 24 h is p50 0.69, p90 1.84, p99 3.49 on four cores, and only one sample of 288 exceeded four. The metadata store is 112 MB with 204 k file_list rows from 326 metric streams, which is why the single writer matters at all.

align_time: false gives every alert its own schedule. Nothing in these rules depends on clock alignment: each expression takes its own range relative to evaluation time. A test refuses an aligned alert.

https://claude.ai/code/session_0128syXKxAGCfJGRDxUUNQXp

OpenObserve snaps an aligned alert's next run to the previous interval
boundary for its frequency, so with alignment on every one-minute rule
evaluates at :00 and every ten-minute rule at :00, :10, :20 -- thirty-four
alerts issuing their searches and persisting their group states in the same
millisecond.

Measured on 2026-09-02 on the live services host: the searches queued
behind each other until some exceeded the PromQL load-data timeout, which
is what raised alert_evaluation_failed sixteen times in two minutes; and
the state writes queued behind SQLite's single writer until they were
refused -- "could not persist group states ...: database is locked", 2386
times in one day, about 190 an hour, peaking on the ten-minute boundaries.
A scheduler that cannot persist that it already notified notifies again on
the next tick, which is why the channel repeated the same page every ten
minutes for hours on 2026-09-01.

Nothing in these rules depends on clock alignment: every expression takes
its own range relative to evaluation time. A test refuses an aligned alert.

Claude-Session: https://claude.ai/code/session_0128syXKxAGCfJGRDxUUNQXp
@rldyourmnd
rldyourmnd enabled auto-merge September 2, 2026 15:58
@rldyourmnd
rldyourmnd merged commit 56f7ec6 into main Sep 2, 2026
10 checks passed
@rldyourmnd
rldyourmnd deleted the fix/alerts-do-not-evaluate-in-one-herd branch September 2, 2026 16:01
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.

1 participant