You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0453aa1
Browse filesBrowse the repository at this point in the historyBrowse files
fix(api): resolve a vanished alert group with its values (#3507)
## Summary
Closes#3470
Stores a grouped alert's group-by values on its history row and reads them back at resolve time, so `{{attributes.*}}` and `{{var.*}}` are filled in when a group resolves after it has disappeared from the data. Until now they rendered empty on that resolve: the group had no rows left to read values from, and the joined `group` string on the history row cannot be split back into values.
- `groupValues` is a list of `{ key, value }` pairs rather than an object, since group-by column names can contain dots and Mongo would read them as nested paths.
- Live values still win. The history fallback applies only when the group has no current rows.
- Empty values are stored too. History rows written before this change have no `groupValues`; they resolve as they do today, and the next evaluation of a live group stores the values.
- The docs no longer say `{{var}}` is empty on the resolve of a vanished group.
### How to reproduce
**Starting point:** `yarn dev`, a webhook destination whose body template uses `{{var.service}}`, and a group-by alert on `service`.
**On `main`:**
1. Let the alert fire for one `service` value, then stop sending data for that value and wait out the alert window.
2. The next evaluation resolves the alert, and the webhook body has an empty `{{var.service}}`.
**On this branch:**
1. Repeat the steps above.
2. The resolve body carries the group's `service` value.
`make dev-int FILE=checkAlerts` runs the new cases: plain and dotted aliases, a generic webhook body, an empty value, and a legacy row.
### How to test on Vercel preview
N/A, API-only change
### References
- Linear Issue:
- Related PRs:
fix: A grouped alert whose group vanishes from the data now resolves with the group's values in `{{attributes.*}}` (alert title and message) and `{{var.*}}` (webhook body)
Copy file name to clipboardExpand all lines: docs/alert-webhook-template-variables.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ a HyperDX alert without parsing the human-readable message body.
21
21
|`{{thresholdMax}}`| number | Upper bound of a `between`/`outside` condition. Always unset for every other comparator, even if the alert was once a range, so guard it (see below). |
22
22
|`{{value}}`| number | The value that triggered or resolved the alert. |
23
23
|`{{groupKey}}`| string | The breaching group, for a grouped alert. |
24
-
|`{{var}}`| object | The breaching group's values by group-by column or SQL alias. Use one value at a time, e.g. `{{var.customer_id}}`, or `{{var.[service.name]}}` for a name with dots. Empty when not grouped, and on the resolve of a group that has no rows left. |
24
+
|`{{var}}`| object | The breaching group's values by group-by column or SQL alias. Use one value at a time, e.g. `{{var.customer_id}}`, or `{{var.[service.name]}}` for a name with dots. Empty when not grouped. |
25
25
|`{{sourceQuery}}`| string | The condition behind the alert — search expression or SQL (see below). |
26
26
|`{{teamId}}`| string | Team the alert belongs to. |
27
27
|`{{note}}`| string | The alert's freeform note — commonly a runbook link. |
0 commit comments