Skip to content

feat(alerts): business heartbeats — NO_EVENTS eventName + rule editor - #837

Merged
unjica merged 1 commit into
developfrom
feat/business-heartbeats
Oct 20, 2026
Merged

unjica merged 1 commit into
developfrom
feat/business-heartbeats

Conversation

@unjica

@unjica unjica commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator

Business heartbeats MVP: alert when an expected custom event (e.g. trackEvent("signup_verified")) has not arrived for X hours.

API (apps/api/src/lib/alert-rules.ts)

  • NO_EVENTS takes an optional eventName (trimmed, 1–200 chars, nullable). The normalizer only emits the key when set, so rules without it serialize and evaluate exactly as before.
  • countEvents adds where.name when set (uses the existing [project_id, name, created_at] index).
  • Alert text names the event (no "signup_verified" events in the last 6 hours in production) and links to /dashboard/events?name=…. Unnamed rules keep the overview link and text.

Dashboard

  • Rule editor Type select now offers "No events (heartbeat)": event name (free text — no existing cheap event-name endpoint for suggestions), "No event for (hours)" 1–24, environment, plus inline guidance about matching the window to real traffic and no recovery notification.
  • Defaults: 6 h window; cooldown follows the window (6 h) unless the user changed it.
  • API-created NO_EVENTS rules with non-whole-hour windows stay list/toggle/remove-only (no silent rounding). ERROR_COUNT editing unchanged.

Docs: "Business heartbeats" recipe in docs/ALERT-RULES.md and /docs/alerts; corrected "editor authors error-count only / API-only" copy (README, docs pages, llms.txt, two marketing pages); CHANGELOG.

Tests: API — name filter, name + environment, unnamed rules unchanged, validation (empty/too long/non-string name, >24h). Dashboard — lib parse/serialize/defaults/round-trip and editor component.

No DB migration, no SDK change, no recovery notifications/templates/>24h windows.

@unjica
unjica merged commit 83fbce2 into develop Oct 20, 2026
7 checks passed
@unjica unjica mentioned this pull request Oct 20, 2026
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