Repository navigation
feat(api): alert rules conditions + scheduled evaluator (#534) - #543
Merged
Merged
Conversation
Add ERROR_RATE, SESSION_DROP, NEW_ERROR_GROUP, AFFECTED_USERS, QUOTA_PERCENT, NO_EVENTS, and HEARTBEAT evaluators plus an idempotent cron job so non-ingest conditions can fire through fireProjectAlert with shared cooldown dedupe. Co-authored-by: Cursor <[email protected]>
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit aa8520f. Configure here.
Replace wall-clock bucket cooldown with atomic last_fired_at claims so elapsed cooldown is enforced across concurrent sweeps, and skip scheduled evaluation for soft-deleted projects/orgs to match ingest auth. Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
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.

Summary
ERROR_RATE,SESSION_DROP,NEW_ERROR_GROUP,AFFECTED_USERS,QUOTA_PERCENT,NO_EVENTS, andHEARTBEATcondition evaluators (AND semantics; unknown types skipped safely).alert-rules-evaluator) that coexists with ingest-triggered evaluation; shared cooldown dedupe; delivery only viafireProjectAlert.ALERT_RULES_SCHEDULE_INTERVAL_MINUTES, default 5) and Railway cron setup; dashboard lists/summarizes new kinds (ERROR_COUNT editor unchanged).Closes nothing yet — tracks #534 (parent vision #493 stays open).
Test plan
pnpm --filter api test -- src/lib/alert-rules.test.ts src/jobs/alert-rules-evaluator.test.tspnpm --filter dashboard test -- lib/alert-rules.test.tspnpm lintHEARTBEAT/NO_EVENTSrule via API; runpnpm --filter api alert-rules-evaluatorand confirm fire + cooldownERROR_COUNTrules and does not evaluate schedule-only rulesMade with Cursor