fix(alerts): the rules no longer evaluate in one herd - #378
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The alert channel has been repeating the same page every ten minutes for hours, and
alert_evaluation_failedhas 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 withalign_time: trueevery one-minute rule evaluates at:00and 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:
metrics->search: wait in queue, all at the same timestamp) until some exceed the PromQL load-data timeout — that is what raisedalert_evaluation_failed, sixteen times in two minutes, with each failing expression completing in 40–57 ms when run alonecould not persist group states ...: database is locked, 2386 times in one day, about 190 an hour, peaking on the ten-minute boundariesThe 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_listrows from 326 metric streams, which is why the single writer matters at all.align_time: falsegives 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