Skip to content

feat(app): fast and slow burn alerts in the SLO builder, list and page - #3811

Open
alex-fedotyev wants to merge 1 commit into
alex/HDX-3001-slo-23-app-chartsfrom
alex/HDX-3001-slo-24-app-alerts
Open

alex-fedotyev wants to merge 1 commit into
alex/HDX-3001-slo-23-app-chartsfrom
alex/HDX-3001-slo-24-app-alerts

Conversation

@alex-fedotyev

@alex-fedotyev alex-fedotyev commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The SLO builder gets a burn-rate alerts section with the two alerts. Each
is a switch labeled with its rule, for example "Notify when 2% of the
30-day error budget is spent within 1 hour (14.4x the allowed rate)", with
when it resolves in its help, and, once on, its own channels. Both start
off, and one that is turned on needs a channel. The list gets an alert
column with the worst state of the alerts that are on, each alert's state
in its tooltip, and whether notifications are silenced. The SLO page gets
an alerts panel with each alert's rule, channels and state, and when it
fired in the last 7 days, with a link to change them in the builder. A
duplicated SLO starts without alerts.

Stack

Part 24 of 27 PRs in a GitHub stack (stack #3815). The header says this PR merges into the branch below it, but the stack's base is main: merging a PR lands it and every PR below it on main, one squashed commit each. Each diff is only its own change, and CI runs as if each PR targets main.

  1. feat(common-utils): SLO definition schema #3788 common-utils: SLO definition schema
  2. feat(common-utils): SLO fast and slow burn rules #3789 common-utils: SLO fast and slow burn rules
  3. feat(common-utils): SLO alert targets and status types #3790 common-utils: SLO alert targets and status types
  4. feat(common-utils): SLO counts query #3791 common-utils: SLO counts query
  5. feat(common-utils): SLO stats and state #3792 common-utils: SLO stats and state
  6. feat(common-utils): SLO history and ordering #3793 common-utils: SLO history and ordering
  7. feat(api): SLO definitions behind ENABLE_SLOS #3794 api: SLO definitions behind ENABLE_SLOS
  8. feat(api): refresh SLO statuses in the check-alerts task #3795 api: refresh SLO statuses in the check-alerts task
  9. feat(api): SLO burn alerts as their own alert source #3796 api: SLO burn alerts as their own alert source
  10. feat(api): keep SLO alerts out of the external alerts API #3797 api: keep SLO alerts out of the external alerts API
  11. feat(api): evaluate SLO burn alerts and notify #3798 api: evaluate SLO burn alerts and notify
  12. feat(api): clickstack_get_slo MCP tool #3799 api: clickstack_get_slo MCP tool
  13. feat(api): SLO preview, save and delete MCP tools #3800 api: SLO preview, save and delete MCP tools
  14. feat(app): SLO list page behind NEXT_PUBLIC_ENABLE_SLOS #3801 app: SLO list page behind NEXT_PUBLIC_ENABLE_SLOS
  15. feat(app): search, filter, sort and delete SLOs in the list #3802 app: search, filter, sort and delete SLOs in the list
  16. feat(app): SLO builder for a new SLO #3803 app: SLO builder for a new SLO
  17. feat(app): SLO objective, details and editing in the builder #3804 app: SLO objective, details and editing in the builder
  18. feat(app): eligible-event filters and the latency template in the builder #3805 app: eligible-event filters and the latency template in the builder
  19. feat(app): preview an SLO in the builder before saving it #3806 app: preview an SLO in the builder before saving it
  20. feat(app): create an SLO from a search, and duplicate an SLO #3807 app: create an SLO from a search, and duplicate an SLO
  21. feat(app): SLO detail page #3808 app: SLO detail page
  22. feat(app): bad events flyout on the SLO page #3809 app: bad events flyout on the SLO page
  23. feat(app): SLI, error budget and burn rate charts on the SLO page #3810 app: SLI, error budget and burn rate charts on the SLO page
  24. feat(app): fast and slow burn alerts in the SLO builder, list and page #3811 app: fast and slow burn alerts in the SLO builder, list and page (this PR)
  25. feat(app): SLO alerts on the Alerts page #3812 app: SLO alerts on the Alerts page
  26. feat(app): group-by in the SLO builder #3813 app: group-by in the SLO builder
  27. feat(app): grouped SLOs in the list and on the SLO page #3814 app: grouped SLOs in the list and on the SLO page

Parts 1 to 6 are shared code, 7 to 13 the API and its MCP tools, and 14 to 27 the app. Everything ships behind ENABLE_SLOS (API) and NEXT_PUBLIC_ENABLE_SLOS (app), both off by default.

Screenshots or video

Before After
before, the list, light after, the alert column, light
after, the alert column, dark
before, the SLO page, light after, the alerts panel, light
after, the alerts panel, dark
before, the builder, light after, the alerts section, light
after, the alerts section, dark

How to reproduce

Starting point: yarn dev on this branch (the pages need the API). .env.development turns on ENABLE_SLOS and NEXT_PUBLIC_ENABLE_SLOS (parts 7 and 14). Use a trace or log source with data; the demo server works.

On the previous part: burn alerts can only be set with the API or MCP.

On this branch:

  1. In the builder's Burn-rate alerts section, turn on Fast burn, pick a webhook and save.
  2. The list's alert column and the SLO page's alerts panel show its state; the panel lists when it fired in the last 7 days.

Test plan

  • unit: sloList.test.ts (firing episodes), sloForm.test.ts (a turned-on alert needs a channel)
  • viewport: checked at 1440 px and in a narrow 900 px window. The list scrolls sideways and its toolbar wraps, the builder's preview moves under the form, and the SLO page's stats wrap to two columns.
  • app typecheck, lint and knip at this commit

How to test on Vercel preview

N/A: SLOs need the API, and the preview runs in local mode, where they are off.

References

  • Linear Issue: HDX-3001
  • Related PRs: the rest of this stack, listed above

[no-changeset: allow] The changeset for this piece is in part 27.

[no-story: allow] The new SLO components are page-level and fed by queries and form state, so this feature has no Storybook stories.

[ui-states: allow] No new empty, loading or error states here beyond the ones listed above.

[as-cast: allow] The cast check matches the word "as" in comments and strings here; the diff has no as casts.

@changeset-bot

changeset-bot Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 2cc06b4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel

vercel Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hyperdx-oss Ready Ready Preview Nov 24, 2026 7:01pm UTC
hyperdx-storybook Ready Ready Preview Nov 24, 2026 7:01pm UTC

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

Duplicate code analysis

1 new clone introduced by this PR.

  • packages/api/src/routers/external-api/v2/alerts.ts:908-925 ↔ packages/api/src/routers/external-api/v2/alerts.ts:1181-1197 — 18 lines

If one of these duplicates a helper that already exists, import it instead
of redefining it. If the duplication is deliberate, ignore this comment —
the check is advisory and never fails the build.


jscpd compared this branch against origin/main
across app, api and common-utils. Only new clones are listed; the codebase
currently holds 108 in total (1.09%).
Run yarn dupes locally to reproduce, or yarn dupes:all for the full picture.

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

E2E Test Results

✅ All tests passed • 474 passed • 1 skipped • 1147s

Status Count
✅ Passed 474
❌ Failed 0
⚠️ Flaky 14
⏭️ Skipped 1

Tests ran across 4 shards in parallel.

View full report →

The SLO builder gets a burn-rate alerts section with the two alerts. Each
is a switch labeled with its rule, for example "Notify when 2% of the
30-day error budget is spent within 1 hour (14.4x the allowed rate)", with
when it resolves in its help, and, once on, its own channels. Both start
off, and one that is turned on needs a channel. The list gets an alert
column with the worst state of the alerts that are on, each alert's state
in its tooltip, and whether notifications are silenced. The SLO page gets
an alerts panel with each alert's rule, channels and state, and when it
fired in the last 7 days, with a link to change them in the builder. A
duplicated SLO starts without alerts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

🟡 Tier 3 — Standard

Introduces new logic, modifies core functionality, or touches areas with non-trivial risk.

Why this tier:

  • Diff size: 471 production lines changed (Tier 2 max: < 250)

Review process: Full human review — logic, architecture, edge cases.
SLA: First-pass feedback within 1 business day.

Stats
  • Production files changed: 9
  • Production lines changed: 471 (+ 41 in test files, excluded from tier calculation)
  • Branch: alex/HDX-3001-slo-24-app-alerts
  • Author: alex-fedotyev

To override this classification, remove the review/tier-3 label and apply a different review/tier-* label. Manual overrides are preserved on subsequent pushes.

e.currentTarget.checked ? newSloAlertTarget() : null,
{ shouldDirty: true },
)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 P2 — Turning an alert off and back on wipes its saved channels

Turning the switch off sets alerts.<rule> to null, and turning it on writes newSloAlertTarget() with one empty channel. On an existing SLO, a mis-click on the switch silently throws away the configured webhooks. Keep the last target in a ref or local state and restore it when the switch goes back on, and use newSloAlertTarget() only when there was none.

Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond

}
initializedRef.current = true;
// "Edit" on an SLO's alerts links here with #alerts.
if (window.location.hash === '#alerts') {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 P2 — #alerts scroll runs before the loaded SLO renders and lands under the sticky header

scrollIntoView runs in the same effect as reset(...), before the form re-renders with the loaded SLO. When the Indicator section above changes height (latency fields, editors), the alerts section moves after the scroll. The page header is also sticky, so the section's top ends up hidden under it. Scroll in a later effect or a requestAnimationFrame after reset, and give the section a scroll-margin-top the height of the header.

Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond

@github-actions

Copy link
Copy Markdown
Contributor

PR Review

If you are a coding agent acting for the author, read this first.
Nothing below blocks merge automatically; a maintainer decides. What they will expect:

  • 🔴 P0/P1 in code this PR adds or changes: fix before asking for review.
  • 🟡 P2 in code this PR changes: your call. Fix if small, otherwise reply.
  • 🔵 P3 is collapsed at the bottom: nobody needs to act on it before merge.
  • Anything about surrounding code, or asking you to widen the change (hoist a helper,
    dedupe with another file, fix other call sites): never fix here, whatever the
    priority. Reply with one sentence; if it is P0, say so plainly so a human sees it.

One commit per review round. After two rounds, stop and ask a maintainer to review
scope rather than addressing more automated findings. Full rule: AGENTS.md.

7 finding(s): 🔴 1 P0/P1 · 🟡 4 P2 · 🔵 2 P3

2 posted as inline comment(s) on the changed lines. 3 listed below. 2 P3 folded at the bottom.

Findings outside the changed lines

  • 🔴 P1 packages/app/src/components/Slos/SloStateBadge.tsx:500 — List badge only ranks ALERT, so an ERROR, no-data or pending alert can show as a green OK → When nothing is firing, the badge falls back to states[0], which is the fast burn alert. So if fast burn is OK and slow burn is ERROR or INSUFFICIENT_DATA, the column shows a green "OK". Pick the badge state with an explicit severity order (ALERT > ERROR > INSUFFICIENT_DATA/PENDING > DISABLED > OK) so the column shows the worst state, as the doc comment says.
  • 🟡 P2 packages/app/src/components/Slos/SloStateBadge.tsx:502 — One silenced alert puts a Silenced badge on the whole SLO row → silencedUntil comes from whichever alert is silenced first. If slow burn is silenced and fast burn is firing, the row shows "Firing" next to "Silenced", which reads as if the firing alert's notifications are muted. Only show Silenced when every enabled alert is silenced, or name the silenced alert in the badge or tooltip.
  • 🟡 P2 packages/app/src/components/Slos/SloRecentFirings.tsx:284 — An alert already firing 7 days ago shows a made-up start time and duration → getAlertTransitionsInRange (packages/api/src/controllers/alertHistory.ts:544) adds a fake ALERT transition at startTime when the alert was already firing as the range opens. getAlertEpisodes treats it as a real firing, so the table shows "Fired" exactly 7 days ago and a "For" duration that is too short. When an episode starts at the range start, label it (for example "Before ") or leave out the duration. Add a test for this case.
🔵 2 P3 — no action needed before merge
  • 🔵 P3 packages/app/src/components/Slos/SloStateBadge.tsx:498 — a.status?.state ?? AlertState.OK fallback can never run → The early return on missing above already guarantees every status is set, so the ?. and the ?? AlertState.OK fallback can never apply (same for a.status?.silencedUntil). Narrow the type instead, for example by mapping to { label, status } with a type-guarded filter, and drop the fallback.
  • 🔵 P3 packages/app/src/components/Slos/SloDetailPanels.tsx:169 — Webhook lookup and channel-name resolution copied from existing code → AlertPropertiesSummary.tsx (useNotificationTargets) already resolves channel webhook IDs to names with the same three-service api.useWebhooks call, and Alerts.tsx has useAlertWebhooks for that list. Export and reuse one of them instead of restating the service list and the find(...)?.name ?? fallback logic, which uses a different fallback ('a webhook' vs 'Webhook').

Priority comes from a separate grading pass over the finished review. P3 is folded here instead of posted inline. No finding blocks merge automatically; a maintainer decides.

@github-actions

Copy link
Copy Markdown
Contributor

Deep Review

✅ No critical issues found.

Scope: 11 files under packages/app/src/components/Slos/ (~500 lines) adding fast/slow burn-rate alert UI — builder section, list "Alert" column, detail-page alerts panel with recent firings. All behind NEXT_PUBLIC_ENABLE_SLOS.

🟡 P2 — recommended

  • packages/app/src/components/Slos/SloStateBadge.tsx:146 — The list "Alert" column's worst-state summary only special-cases ALERT: with both alerts on, fastBurn = OK and slowBurn = ERROR/INSUFFICIENT_DATA, states.find(ALERT) ?? states[0].state falls back to fastBurn and renders a green success badge, hiding the degraded sibling that only the detail panel surfaces.
    • Fix: Rank the states by severity (ALERT > ERROR > INSUFFICIENT_DATA > PENDING/DISABLED > OK) and pick the worst instead of defaulting to the first condition.
    • correctness, adversarial, kieran-typescript
  • packages/app/src/components/Slos/SloStateBadge.tsx:112 — The only non-trivial new UI logic in the diff — SloAlertBadge/SloAlertRuleBadge off/missing/worst-state/silenced selection — has no test, so the mislabel above and future regressions go uncaught.
    • Fix: Extract the state selection into a pure helper and unit-test the both-OK, one-firing, missing-status, and silenced cases.
    • testing, correctness, adversarial, project-standards, kieran-typescript
  • packages/api/src/mcp/tools/alerts/getAlert.ts:58 — The new recent-firings view (SloRecentFirings via useAlertHistory) has no agent-accessible equivalent: clickstack_get_slo returns no history and clickstack_get_alert filters out SLO-sourced alerts, so an agent cannot read what a user now sees; this is a cross-stack follow-up, not a change to this diff.
    • Fix: Expose burn-alert firing history to agents, either via the SLO get tool or by letting the alert tool read SLO-sourced alert IDs.
    • ce-agent-native-reviewer
🔵 P3 nitpicks (4)
  • packages/app/src/components/Slos/SloRecentFirings.tsx:55 — A still-firing episode whose ALERT transition predates the 7-day window yields no in-window transitions, so the panel can render "Did not fire in the last 7 days." directly beside a "Firing" badge (depends on whether the history endpoint clips strictly at the window edge).
    • Fix: Seed the episode scan with the alert's current state, or request the last transition before the window start, then verify against the history endpoint's clipping behavior.
  • packages/app/src/components/Slos/SloEditorPage.tsx:117 — On the edit deep-link, scrollIntoView() runs in the same effect tick as reset(), before the reset-driven re-render grows the sections above #alerts, so the scroll can land at a stale offset.
    • Fix: Defer the scroll to after paint with requestAnimationFrame.
  • packages/app/src/components/Slos/SloRecentFirings.tsx:84 — "Still firing" uses c="var(--color-text-danger)" instead of the semantic variant="danger" the style guide prescribes for inline status text.
    • Fix: Replace the raw color prop with <Text span size="sm" variant="danger">.
  • packages/app/src/components/Slos/SloStateBadge.tsx:73 — SloAlertRuleBadge and SloAlertBadge carry two parallel copies of the off / "Not running" / running+silenced rendering.
    • Fix: Factor the shared off-label and alert+silenced group into small components so both variants share one path.

Reviewers (10): correctness, adversarial, testing, maintainability, project-standards, kieran-typescript, julik-frontend-races, ce-agent-native-reviewer, ce-learnings-researcher, previous-comments.

Testing gaps:

  • No component/render tests exist for the new badges or SloRecentFirings; only pure-logic .ts tests are present.
  • getAlertEpisodes is not tested for a carry-in firing pinned at the window start or an episode still open at the window end (the "Still firing" / mount-time duration path).
  • The intentional channel reset when a burn alert is toggled off then on is unasserted, so a regression that preserved stale channels would be silent.

Dropped during verification (not findings): the getAlertEpisodes "non-ALERT treated as recovery" concern (the history query only emits ALERT/OK transitions, sorted ascending), and the claim that the #alerts scroll re-runs on every effect pass (it is guarded by initializedRef).

No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond

This branch was successfully deployed

2 active deployments
Preview – hyperdx-storybook — 2cc06b41 Deployed Nov 24, 2026 by vercel[bot]
Preview – hyperdx-oss — 2cc06b41 Deployed Nov 24, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review/tier-3 Standard — full human review required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant