Repository navigation
Add the Custom-rules alert notebook template (#4223) - #4433
Merged
Merged
Conversation
An alert fired by a custom rule (Custom:<id>) now opens an authored notebook: header, status, and one composed panel built from the rule's own plan (same source/measure/filters/aggregate), forced into time-bucket mode over the alert window, with the rule's threshold or band carried as reference-line values. A deleted rule or a definition that no longer parses degrades to a note, never an error. Refs #4223.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #4223.
Why
A custom alert rule fires as
Custom:<id>, and until now that metric name fell through to the mechanical notebook conversion — no chart of the rule's own measure, no threshold or band shown against the window that fired it.What changes
Registers a
Custom:prefix row (AuthoredContextKind.CustomRule) in the endpoint's authored-template table, which was empty. Adds a new file,AlertNotebookEndpoint.Templates.CustomRules.cs, with the template's cell builder.timeBucket: "hour"(the rule's own plan is alwaysScalar), absoluterangeover the alert window, and up to 4thresholdsreference-line values carrying the rule's warn/critical (scalar op) or lower/upper bound plus optional critical band (range op)The panel's
thresholdskey is the same render-only reference-line array a composed panel already accepts; there is no separate "band" key on that schema, so a range rule's bounds ride in that same array (checked againstComposeSpecandDarlingWebEndpoints.ValidateNotebookDefinition).Test plan
New file
Darling/Darling.Tests/AlertNotebookTemplateCustomRulesTests.cs, 11 pins:Custom:42routes toauthored/custom-rule; an exact-name metric still wins;Customwith no colon stays mechanical).gt, warn 80 / critical 95): panel's source/measure/aggregate identical to the stored plan,timeBucketset, thresholds[80, 95], and it passesValidateNotebookDefinition.between, 10/90): thresholds[10, 90], and it passesValidateNotebookDefinition.CustomRuleMissing = true): note cell, 3 cells total (header/status/note), passes validation.Custom:prefix family, since the sharedAllAuthoredMetricstheories inAlertNotebookAuthoredTemplateTestsonly walk the exact-name table.Run results (this Mac, in-process xunit v3 runner,
Microsoft.WindowsDesktop.Appframework entry stripped from the runtimeconfig per the repo's macOS test recipe):AlertNotebookTemplateCustomRulesTests: 11/11 pass.AlertNotebookAuthoredTemplateTests: 128/128 pass.AlertNotebookEndpointTests: 29/29 pass.DocCommentHygieneTests: 77/77 pass.AlertNotebookAuthoredContextTests: 26/26 on a live rig. ItsProductionPrefixTable_IsEmptyInThisStepbecameProductionPrefixTable_HoldsExactlyTheRegisteredContextFamilies, which pins the singleCustom:/CustomRulerow this PR registers.RED proven: copied the new test file onto pre-fix
origin/dev(ef7e75df4) in a detached worktree, built clean (0/0), ran the same class: 9 of 11 fail (the two routing negatives that don't touchCustom:still pass), becauses_authoredPrefixTemplateswas empty there —ResolveAuthored("Custom:42")returnednull.Both
Darling.TestsandLite.Testsbuild 0 warnings-as-errors-relevant/0 errors (Lite.Testsis build-only here; it targetsnet10.0-windowsand cannot run here).CHANGELOG entry
SECTION: Added
ENTRY:
REF: [Add the Custom-rules alert notebook template (#4223) #4433]: Add the Custom-rules alert notebook template (#4223) #4433