Introducing a new way to review your PRs.

Read the announcement

hyperdxio / hyperdx

Resolve production issues, fast. An open source observability platform unifying session replays, logs, metrics, traces and errors powered by ClickHouse and OpenTelemetry.

View on GitHub

19 documents · Updated Oct 30, 2026

docs / alerting-and-notifications

Alerting and notifications

Alerting turns a saved search, dashboard tile, or inline chart into a scheduled condition check. Background work compares each result with its rule, stores the condition and its history, sends webhook messages, and makes the result available in the API and alert views.

Alert configuration

An alert joins a source, a rule, an evaluation schedule, and one or more notification channels. Users create alerts from source editing views or manage them from the alert detail view.

Alert sources

An alert watches a saved search, a dashboard tile, or an inline chart. A saved-search alert counts matching log or trace records and can split the result by a group expression. A tile alert follows the chart query in a dashboard. An inline alert keeps its chart query with the alert, so it does not depend on a saved search or tile.

The API checks that referenced dashboards, searches, sources, connections, and webhooks belong to the caller's team. It also keeps the source rules used by the editor aligned with the source rules used by the evaluator. For raw SQL charts, the worker runs the query through the connection stored in the chart configuration. If an optional source later moves to another connection, the worker drops that source's metadata instead of applying metadata from the wrong connection.

SourceCondition inputUser link
Saved searchMatching records in the saved search's time windowThe saved search with the evaluated time range
Dashboard tileThe tile's chart value or seriesThe dashboard with the alert tile highlighted
Inline chartThe stored chart query's value or seriesThe chart explorer with the alert query and evaluated range

Dashboard-backed alerts use the same chart model as dashboard visualization. See dashboards and visualization for the wider dashboard experience.

References: packages/…/alert.ts• L72-77 packages/…/alerts.ts• L60-236 packages/…/index.ts• L667-856 packages/…/default.ts• L98-141

Threshold rules

The rule compares each evaluated value with a threshold. Single-bound rules support above, below, equal, and not equal comparisons. Range rules test whether the value is between or outside a lower and upper bound. The preview and the background check use the same boundaries.

When an alert changes from a range rule to a single-bound rule, the unused upper bound is cleared. For grouped alerts, the system keeps a condition state for each group, so one group can fire or recover without changing the other groups.

References: packages/…/alerts.ts• L241-339 packages/…/index.ts• L318-350 packages/…/alert.ts• L89-92 packages/…/index.ts• L1602-1647

Evaluation schedules

An alert evaluates on an interval from one minute to one day. By default, its windows align to the interval boundary. An optional offset shifts those boundaries for late-arriving data. An optional start time anchors the first window and repeats from that time. When both are present, the start time controls alignment and the offset is ignored.

An alert can require the condition to hold for several consecutive windows. Until that count is reached, the condition is PENDING, which reduces messages from short spikes. The worker skips checks before the anchor and does not evaluate the first window until it has elapsed.

References: packages/…/alert.ts• L34-43 packages/…/alerts.ts• L241-258 packages/…/index.ts• L412-459 packages/…/index.ts• L1043-1125 packages/…/index.ts• L1931-2002

Notification channels

An alert sends firing and recovery messages to configured webhook channels. An alert can target several channels. The stored channel list is the main value, while a singular channel mirrors the first entry for older readers.

The evaluator resolves configured channels directly and also accepts webhook targets written as @webhook-... mentions in the message. It queues configured channels first, removes duplicate targets named by both paths, and limits event fan-out. Invalid mentions, missing webhooks, and targets beyond the limit are reported as individual failures, so one bad target does not hide failures or deliveries for other targets.

This compatibility rule matters when a client updates an alert. A replacement update that sends only one channel can remove the other configured destinations.

References: packages/…/alert.ts• L45-70 packages/…/alerts.ts• L216-234 packages/…/template.ts• L666-885 packages/…/index.ts• L265-316

Alert messages

The evaluator builds each message from the alert template and the result context. The message can include the condition value, time window, group, and a link to the watched source. A recovery message uses the same context and identifies that the condition has resolved. Source links match the alert source: saved searches open the search, tile alerts open the dashboard tile, and inline alerts open the chart explorer with the stored query.

Webhook body templates receive the rendered message and stable alert fields. These fields include the alert identity, status, source type, comparator, thresholds, value, group, group values, source query, team, note, tags, and Unix or ISO time values. The source query describes the query that actually drives the alert for its source type, including the last value series for a chart. A webhook without a body template uses the default body for its service. Delivery adds an idempotency key so receivers can recognize repeated attempts.

Saved-search messages can include a small sample of matching rows. If that sample lookup fails, the notification still carries the count and source link without the sample rows.

References: packages/…/template.ts• L137-230 packages/…/template.ts• L295-337 packages/…/template.ts• L524-609 packages/…/template.ts• L611-771 packages/…/types.ts• L7-32 packages/…/generic.ts• L67-113 packages/…/generic.ts• L203-243

Alert evaluation background work

The check-alerts task turns stored alert configuration into state and notification events. It loads each source and connection, groups work by connection, evaluates due windows against ClickHouse, and waits for all scheduled work to finish. See API services and background tasks for the wider task model.

The evaluator uses the shared chart query model. This lets saved searches, dashboard charts, and inline charts follow the same query rules.

The following diagram shows how saved configuration becomes a stored result and a user-visible notification.

flowchart LR
    A[Saved search, dashboard tile, or inline chart] --> B[Scheduled check]
    B --> C[Build source query]
    C --> D[Query ClickHouse]
    D --> E[Compare value with rule]
    E --> F[Record state and evaluation history]
    E --> G{Firing or recovery event?}
    G -->|Yes| H[Render message]
    H --> I[Deliver to webhook channels]
    I --> J[Show result in APIs and UI]
    D -->|Query or processing error| K[Record execution error]
    I -->|Delivery error| K
    K --> J

Scheduled evaluation

The worker reads current alert state and recent history before it runs a check. This prevents duplicate work, allows missed windows to be filled, and supplies the prior windows needed for a multi-window rule. An alert whose source or connection cannot load is skipped for that cycle and logged as a load failure.

The worker builds a task for each source type, groups alerts that use the same connection, limits concurrent work, and drains the queue before the task exits. An anchored alert is skipped until its first complete window is available. A query timeout or other query failure records an error without advancing alert state, so the same window can be retried on a later check.

Each alert evaluation adds query attribution to the work it starts. The attribution identifies the alert and, when available, its saved search, source, dashboard, or tile. It follows the evaluation context through the alert query, query-plan checks, and sample-row queries, so query activity can be traced back to the alert that caused it without changing alert results.

References: packages/…/index.ts• L605-671 packages/…/index.ts• L947-976 packages/…/index.ts• L1043-1125 packages/…/index.ts• L1209-1269 packages/…/index.ts• L1801-1967 packages/…/index.ts• L2043-2069 packages/…/alertQueryAttribution.test.ts• L14-90

State transitions

Each evaluated window produces OK, ALERT, or PENDING state for the alert or for each group. A threshold breach becomes ALERT when no consecutive-window requirement is set. A non-breaching value returns an active condition to OK. A missing time-series bucket is treated as zero when the rule needs a value. A null result is treated as no usable value.

The worker sends a firing message when a condition reaches ALERT and sends a recovery message when an active condition returns to OK. It may send a firing message again while the condition continues to breach. Evaluation history keeps per-window values, breach counts, group identity, and notification errors. ERROR history rows describe failed evaluation or notification work and do not count as successful windows, so the worker can retry the failed window.

References: packages/…/alert.ts• L13-26 packages/…/alertHistory.ts• L35-51 packages/…/index.ts• L1489-1538 packages/…/index.ts• L1542-1761

Notification delivery

The evaluator renders one complete message before it dispatches targets concurrently. Each target has its own result, so a missing destination or failed webhook does not stop other destinations. Pre-dispatch failures and dispatch failures are stored on the alert and in evaluation history. Per-target delivery timing is also kept when a target reaches dispatch.

Generic webhook delivery validates the destination, blocks redirects, applies a bounded timeout to each attempt, and retries failed requests. The timeout uses a positive ALERT_NOTIFICATION_FETCH_TIMEOUT_MS value when set and otherwise defaults to 30 seconds. A missing body uses the default body for the webhook service. Each request carries a stable idempotency key, while delivery metrics record the service and outcome. Raw upstream details stay out of the user-facing error message.

The worker records query time, notification time, backfilled window count, and per-target timing when that data is available. Silencing suppresses notification work while it is active. It does not erase the condition or its history. A silence set after a check enters the queue can take effect on the next check because queued work uses the alert data loaded when the task was prepared.

References: packages/…/template.ts• L470-522 packages/…/template.ts• L690-717 packages/…/template.ts• L953-1021 packages/…/index.ts• L1298-1397 packages/…/index.ts• L1718-1788 packages/…/generic.ts• L126-160 packages/…/generic.ts• L180-292

Evaluation history

Evaluation history explains why an alert is active, pending, resolved, or unhealthy. The system keeps it for about 30 days. The detail API groups rows into evaluation windows and includes group results, query and notification timing, backfilled bucket count, target timing, and error details when available.

The history endpoint used for chart annotations is different from the evaluation endpoint. It returns firing and recovery transitions, so charts can mark the points where an alert entered or left the firing state without displaying every evaluation row.

References: packages/…/alertHistory.ts• L12-51 packages/…/alertHistory.ts• L130-144 packages/…/alerts.ts• L206-289 packages/…/alerts.ts• L291-340 packages/…/AlertEvaluationsTable.tsx• L21-104

Alert user experiences

The UI gives users a summary view for triage and a detail view for investigation. Both views read alert state and history. Source editors remain creation paths, while the detail page provides a central place to inspect and change an existing alert.

Alert list

The alerts page loads team alerts and lets users narrow the list by name, state, source type, tag, or creator. The filter bar keeps these choices together and shows when a filter change is settling. Each alert card presents its current state, source identity, recent history, actions, note, tags, and creator when available.

The shared state badge gives each condition a clear label and severity signal. It shows ALERT and ERROR as danger states, PENDING as a warning, OK as success, and disabled or no-data states as neutral. A source icon and tooltip identify the source type when the source is known.

The alert name opens the detail page when that experience is enabled. A separate source link opens the watched search, dashboard tile, or chart when the source resolves. If the source no longer resolves, the card shows the alert name without a link. The list keeps all returned states, including disabled alerts, and loads more cards as the user scrolls.

References: packages/…/AlertsFilterBar.tsx• L17-110 packages/…/AlertCardList.tsx• L62-119 packages/…/AlertDetails.tsx• L93-218 packages/…/AlertStateBadge.tsx• L7-25 packages/…/AlertStateBadge.test.tsx• L25-44

Alert detail

The detail page combines alert status, configuration, source link, actions, a threshold chart, a history strip, and an evaluation table. Its properties block makes the saved notification title, message template, grouping, schedule anchor or offset, acknowledgement, tags, and provenance visible without opening the editor. The chart uses the alert's evaluated window and shows threshold lines plus firing and recovery points. Saved-search, tile, and inline alerts use their own source query for this view. Raw SQL alerts that return one value per window remain valid but do not have a time-series chart; unsupported chart types show a clear fallback instead. The table shows one row per evaluation window, can expand group results, and exposes the latest value, breach count, backfilled buckets, query duration, notification duration, and errors. It loads newer windows first and fetches older windows as the user scrolls.

The page also shows a saved note in a collapsible Markdown view. A feature flag controls the detail route. When the experience is disabled, direct visits return to the alert list.

References: packages/…/AlertDetailPage.tsx• L74-117 packages/…/AlertDetailPage.tsx• L129-285 packages/…/AlertDetailChart.tsx• L122-247 packages/…/AlertDetailChart.tsx• L271-452 packages/…/AlertDetailChart.test.tsx• L57-171 packages/…/AlertDetailProperties.tsx• L31-118 packages/…/AlertDetails.tsx• L93-218 packages/…/AlertEvaluationsTable.tsx• L21-104

Alert editing

Users create saved-search alerts from the saved-search experience and tile alerts from the dashboard chart editor. Inline alerts provide a third path for a chart stored directly on the alert. Shared schedule, threshold, and channel controls keep these paths consistent. The detail page can edit an existing alert and preview its threshold against source data.

The detail editor handles saved-search and tile alerts with controls that match their source. Chart alerts compare chart values, while saved-search alerts can group results by a SQL expression. Inline alerts use a chart-specific editor so their stored query remains part of the alert. The preview changes with the selected rule and schedule, which lets users check the condition before they save it.

The editor sends a complete replacement view of the alert while preserving its source identity and fields that the form does not change. This prevents a detail edit from clearing the alert message or changing the source type. A successful save refreshes the detail page, alert list, and source-bound views; a failed save keeps the form open so the user can correct it.

Saving an alert sends the source and rule configuration to the API. The API rejects unsupported chart types, invalid raw SQL, cross-connection source references, unsupported formula sources, and channels not owned by the team. It clears a stale upper bound when an alert changes away from a range rule.

References: packages/…/alerts.ts• L60-236 packages/…/alerts.ts• L241-379 packages/…/alert.ts• L79-131 packages/…/AlertDetailPage.tsx• L168-180 packages/…/EditAlertModal.tsx• L62-147 packages/…/EditAlertModal.tsx• L171-312

Alert acknowledgement

Acknowledgement is a timed silence action for an active alert. The UI offers fixed duration choices. The API records who set the silence and when it ends. After expiry, the alert resumes without a configuration change.

References: packages/…/alerts.ts• L397-463 packages/…/AlertDetailPage.tsx• L168-180 packages/…/AlertDetails.tsx• L201-216 packages/…/AlertDetailProperties.tsx• L80-92

Alert API paths

The authenticated /alerts routes provide the application-facing contract for alert reads, writes, history, and silence actions. Every alert lookup is scoped to the authenticated team. Related external automation can use the interfaces described in external interfaces and automation.

Internal alert API

The internal routes support list and detail reads, alert creation, replacement updates, deletion, timed silencing, and unsilencing. They also expose recent history with alert reads, paginated evaluation windows for the detail page, and firing or recovery transitions for source charts.

The evaluation and transition routes cap the requested time span to the history retention window. The detail response includes the inline chart configuration when one alert is requested. The list response omits that full configuration so a list load does not carry every stored chart query.

References: packages/…/alerts.ts• L39-119 packages/…/alerts.ts• L121-203 packages/…/alerts.ts• L206-340 packages/…/alerts.ts• L342-489

Change checklist

When these files or sections are changed, remember to consider these:

  • When an alert source changes, keep write validation, source loading, query assembly, source links, message links, and the detail response aligned for saved-search, tile, and inline alerts.
  • When inline raw SQL sources change, keep the connection ownership check aligned with the worker's query connection and source macro expansion.
  • When an alert field or state changes, keep the alert model, API response shape, worker state logic, notification payload, and list and detail views aligned. The detail properties block must also expose the intended persisted fields without implying that provenance is configuration.
  • When a channel type changes, update channel validation, configured-channel resolution, mention parsing, delivery behavior, and the mirrored legacy channel value together.
  • When webhook payload fields change, update the message contract, source-query construction, generic template variables, time formats, group values, tags, default body behavior by service, and receiver-facing documentation together.
  • When evaluation history changes, keep window grouping, error rows, analytics, chart transitions, the evaluation table, and the history strip compatible.
  • When schedule behavior changes, keep UI controls and worker window calculation aligned so the preview and evaluated window refer to the same period.
  • When update semantics change, review clients that round-trip the complete configuration. Partial writes can silently remove notification channels or source fields.
  • When notification fan-out changes, preserve configured-channel priority, target deduplication, the per-event cap, independent delivery, target-specific error reporting, and delivery timing aggregation.
  • When a range comparator changes, keep upper-bound storage, update clearing, comparison, and webhook payload rendering aligned.
  • When alert query execution or source loading changes, preserve query attribution for the alert and its source while keeping attribution failures non-blocking for evaluation. Query failures must remain retryable and must not advance state or create a normal history row.
  • When alert state labels or badge severity changes, keep the shared badge mapping aligned with the state values shown in alert cards and its coverage test.
  • When alert chart support changes, keep source resolution, display-type fallbacks, threshold lines, annotations, and the detail-chart coverage tests aligned for saved-search, tile, and inline alerts.
  • When webhook delivery changes, keep URL validation, redirect blocking, per-attempt timeout, retry behavior, idempotency keys, and delivery metrics aligned.

Important failure modes

TriggerConsequenceGuard
The saved search, dashboard, tile, inline chart source, or connection no longer existsThe worker cannot build the alert task, so that alert is skipped for the cycleValidate team-owned references on writes and monitor worker load errors
An inline raw SQL chart names a source that later moves to a different connectionThe worker ignores that source's metadata and still runs the query through the chart's configured connection. Queries that need the dropped metadata can fail with a recorded query errorKeep source and chart connections aligned, and treat a query error after a source move as a configuration problem
An alert chart uses an unsupported display type, or a raw SQL alert returns one value per windowThe API may reject unsupported configuration, or a valid single-value raw SQL alert has no time-series chart in the detail viewKeep alert validation, evaluator support, and detail-chart fallback behavior aligned
The ClickHouse query fails or times outNormal state does not advance. An execution error and retryable ERROR history row are writtenFix the source query or its time range and let a later check retry the window
A webhook is deleted, blocked by URL validation, redirected, or rejects the requestThat target misses the message. Other targets can still receive it, and the failure appears in execution historyRepair the webhook and inspect the target-specific error
A client updates a multi-channel alert with only the legacy singular channelThe replacement update can reduce the alert to one destinationRead and resend the complete channel list
A message names a missing webhook or exceeds the event target capThat target is skipped and the alert records a target-specific failure. Other targets still runKeep webhook references valid and keep fan-out within the supported limit
A generic webhook has an invalid template or a receiver does not respond in timeThe request body cannot be built, or delivery fails after bounded attemptsValidate the template and receiver; inspect webhook delivery errors and metrics
A detail edit does not preserve the alert source or fields outside the formA replacement save can clear alert data or change how the alert is evaluatedKeep source identity and untouched fields in the edit payload, and use the chart-specific editor for inline alerts
An active alert is silencedThe condition remains recorded but its notification is skipped until the silence ends. A queued check may use the earlier silence valueCheck silence metadata before treating the absence of a message as recovery
A schedule anchor is in the future or its first window is not completeThe worker skips the check and does not create a normal evaluation resultTreat the anchor as the start of the alert's window sequence
A client requests history older than the retention periodThe API and UI cannot show evaluations that have expiredTreat the roughly 30-day history window as a retention limit
A state value has no explicit badge mappingThe UI shows the raw state with a neutral badge, which can weaken triage clarityKeep state labels, severity mapping, and the badge coverage test aligned
A receiver accepts a repeated delivery without using the idempotency keyAt-least-once delivery can create duplicate downstream actionsUse the stable idempotency key for receiver-side deduplication

Key files

FileWhy to read it
packages/…/alert.tsDefines alert sources, states, rules, schedules, channels, silence data, and execution errors.
packages/…/alerts.tsShows how alert references are checked and how create and update data is shaped.
packages/…/index.tsDescribes query evaluation, schedule anchors, state transitions, notification events, query attribution, retries, error recording, and task draining.
packages/…/default.tsShows how saved-search, tile, and inline sources become executable alert tasks, how source metadata stays tied to the configured connection, and how state and history are saved.
packages/…/alertQueryAttribution.test.tsShows the query attribution contract for saved-search, tile, inline, populated, and partially populated alert details.
packages/…/template.tsDefines source-aware links and queries, message content, sample rows, webhook target resolution, fan-out, enriched payload fields, and delivery results.
packages/…/generic.tsDefines generic webhook rendering, enriched template variables, default service bodies, validation, retries, timeouts, idempotency, redirect handling, and delivery metrics.
packages/…/types.tsDefines the enriched message contract shared by alert rendering and notification transports.
packages/…/alertHistory.tsDefines evaluation history, diagnostics, indexes, and retention.
packages/…/alerts.tsDefines the application-facing alert, history, evaluation, and silence routes.
packages/…/AlertsPage.tsxShows alert list loading, search, and filter state.
packages/…/AlertDetailPage.tsxShows the investigation view with chart, evaluation history, editing actions, and acknowledgement.
packages/…/AlertDetailChart.tsxShows how each alert source becomes a threshold chart or a clear preview fallback.
packages/…/AlertDetailChart.test.tsxProtects chart behavior for source resolution, builder and raw SQL configs, single-value queries, and unsupported chart types.
packages/…/EditAlertModal.tsxShows the shared detail editor for saved-search and tile alerts, including the live threshold preview and source-preserving save flow.
packages/…/AlertsFilterBar.tsxShows the user-facing list filters for name, state, source, tag, and creator.
packages/…/AlertCardList.tsxShows list ordering, virtualized display, and incremental loading.
packages/…/AlertDetails.tsxShows shared alert card content, source links, source labels, state badges, notes, and row actions.
packages/…/AlertDetailProperties.tsxShows the persisted alert settings and provenance presented on the detail page.
packages/…/AlertEvaluationsTable.tsxShows the evaluation-window view and its diagnostic fields.
packages/…/AlertStateBadge.tsxDefines the shared label and severity treatment for each alert state.
packages/…/AlertStateBadge.test.tsxProtects the user-facing label and severity mapping for all supported alert states.