Repository navigation
perf(ui): lazily render the alert list with Html.Lazy and Html.Keyed - #5357
Conversation
The /alerts view rebuilt and re-diffed the entire alert-group tree on every model update, so interactions such as typing in the filter bar were sluggish when many alerts were loaded. Wrap the alert-group rendering in lazy4 so it is skipped while its inputs are unchanged, and render the group and alert lists with Html.Keyed keyed by group identity and alert fingerprint so list diffs are matched by identity rather than position. Co-Authored-By: Claude Opus 4.8 <[email protected]> Signed-off-by: Will Hegedus <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe Elm alert list view now memoizes the alert-groups section with ChangesKeyed/Lazy Rendering Optimization
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The v2 API can return two alert groups with an identical (receiver, labels) pair when sibling routes share a receiver and group_by but differ only by time intervals, so the group key derived from those fields is not guaranteed unique. Html.Keyed requires keys to be unique among siblings, so the collision could mis-associate DOM nodes. Render the group list with plain indexedMap again. The lazy4 wrapper still skips re-rendering while inputs are unchanged, and the alert list stays keyed by fingerprint, which is unique within a group. Co-Authored-By: Claude Opus 4.8 <[email protected]> Signed-off-by: Will Hegedus <[email protected]>
Thanks @TheMeier! Good point. I dropped the group-level The main tweak that affects performance (the I also kept keyed rendering on the per-group alert list since fingerprint is unique within a group but can drop that if you'd prefer. |
….1 ➔ v0.34.0) (#224) This PR contains the following updates: | Package | Update | Change | |---|---|---| | [quay.io/prometheus/alertmanager](https://github.com/prometheus/alertmanager) | minor | `v0.33.1` → `v0.34.0` | --- >⚠️ **Warning** > > Some dependencies could not be looked up. Check the [Dependency Dashboard](issues/13) for more information. --- ### Release Notes <details> <summary>prometheus/alertmanager (quay.io/prometheus/alertmanager)</summary> ### [`v0.34.0`](https://github.com/prometheus/alertmanager/releases/tag/v0.34.0): 0.34.0 / 2026-08-16 [Compare Source](prometheus/alertmanager@v0.33.1...v0.34.0) - \[CHANGE] notify: The `reason` label on `alertmanager_notifications_failed_total` now distinguishes `authError` (HTTP 401/403) and `rateLimited` (HTTP 429) from the generic `clientError`. Dashboards/alerts matching `reason="clientError"` for these codes must be updated. [#​5332](prometheus/alertmanager#5332) - \[FEATURE] Add optional templatable labels to alert routes. [#​5328](prometheus/alertmanager#5328) - \[FEATURE] eventrecorder: Add inhibit rule names to `inhibition_muted_alert` events. [#​5315](prometheus/alertmanager#5315) - \[FEATURE] eventrecorder: Add stdout output type. [#​5311](prometheus/alertmanager#5311) - \[FEATURE] silences: Add active, expired, and pending boolean filter parameters to GET /api/v2/silences to allow filtering silences by state server-side. [#​5406](prometheus/alertmanager#5406) - \[FEATURE] sns: Add aws `external_id` support in sigv4 configuration. [#​5157](prometheus/alertmanager#5157) - \[FEATURE] template: Add `toDate` and `mustToDate` functions. [#​5327](prometheus/alertmanager#5327) - \[ENHANCEMENT] doc: Add AlertmanagerClusterFailedPeers alertmanager-mixin. [#​5301](prometheus/alertmanager#5301) - \[ENHANCEMENT] doc: Add description for Rocketchat parameters in global config. [#​5181](prometheus/alertmanager#5181) - \[ENHANCEMENT] doc: Add top level tracing configuration key. [#​5314](prometheus/alertmanager#5314) - \[ENHANCEMENT] doc: Fix Alertmanager port in amtool config routes example. [#​5312](prometheus/alertmanager#5312) - \[ENHANCEMENT] eventrecorder: Add optional webhook batching. [#​5392](prometheus/alertmanager#5392) - \[ENHANCEMENT] notify: The discord and webex integrations now report a failure `reason` on `alertmanager_notifications_failed_total`. [#​5332](prometheus/alertmanager#5332) - \[ENHANCEMENT] ui: Improve responsiveness of UI when loading thousands of alerts. [#​5357](prometheus/alertmanager#5357) - \[BUGFIX] eventrecorder: Fixed a minor performance regression when the event recorder is enabled. [#​5307](prometheus/alertmanager#5307) - \[BUGFIX] msteamsv2: Inherit global `proxy_url` into partial `http_config`. [#​5379](prometheus/alertmanager#5379) - \[BUGFIX] webhook: Keep custom `payload` string values verbatim instead of reinterpreting JSON leaves that look like YAML (e.g. values ending with a colon). [#​5304](prometheus/alertmanager#5304) </details> --- ### Configuration 📅 **Schedule**: (in timezone America/Toronto) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4zMC40IiwidXBkYXRlZEluVmVyIjoiNDQuMzIuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsicHJpb3JpdHkvbWVkaXVtIiwicmVub3ZhdGUvY29udGFpbmVyIiwidHlwZS9taW5vciJdfQ==--> Reviewed-on: https://git.dcunha.io/Exikle/frostlink/pulls/224
The /alerts view rebuilt and re-diffed the entire alert-group tree on every model update, so interactions such as typing in the filter bar were sluggish when many alerts (10K+) were loaded.
This wraps the alert-group rendering in lazy4 so it is skipped while its inputs are unchanged, and render the group and alert lists with Html.Keyed keyed by group identity and alert fingerprint so list diffs are matched by identity rather than position.
It's similar to what is done for listing silences here.
Now, even though loading a 30MB+ response of all alerts is still slow on first load, typing in the filter box is at least responsive.
Pull Request Checklist
Please check all the applicable boxes.
Which user-facing changes does this PR introduce?