Repository navigation
Add the authored High CPU alert-notebook template (#4223) - #4420
Merged
Merged
Conversation
High CPU fires on both engines; it now gets an authored 7-cell layout (header, status, a SQL Server CPU timeline, a PostgreSQL CPU timeline, top queries/procedures by CPU, scheduler pressure) instead of the mechanical read list. Both CPU measures are Gauge archetype, so their timelines use a small avg/line helper local to the new file rather than widening the shared TimelinePanel (which is built for count-aggregated per-event sources). Updates two pre-existing tests that hardcoded "High CPU" as an example of a metric staying on the mechanical fallback path to use "Poison Wait" instead, and extends the shared budget theory for the two top-N reads that cap with 'top' rather than 'limit'. 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
"High CPU" fires on both engines (SQL Server and PostgreSQL) and, like the other alert families, was falling back to a mechanical list of reads instead of getting an authored, forensic-shaped notebook.
What changes
AlertNotebookEndpoint.AuthoredTemplate("High CPU")now returns anauthored/cputemplate (version 1) with a fixed 7-cell layout:cpu_utilization_stats/sqlserver_cpu_utilization, avg, line, hourly bucketspg_cpu_utilization/pg_acu_utilization_pct, avg, line, hourly bucketsget_top_queries_by_cpu(hours=24, top=10)get_top_procedures_by_cpu(hours=24, top=10)get_cpu_scheduler_pressureBoth engines' CPU panels are always present — same "not applicable" convention the mechanical map already uses for this metric (the wrong-engine read/panel just comes back empty).
Both CPU measures are Gauge archetype (point-in-time percent readings), so their valid aggregates are avg/min/max, never
count. The sharedTimelinePanelcore helper hardcodesaggregate: "count"for the per-event deadlock/blocking sources it was built for, so this template adds its own smallCpuGaugeTimelinePanelhelper (private to the new file) instead of widening the shared one — that would change what every other already-shipped family's panel emits. No annotation overlay is added: none of the available annotation sources (deadlocks, blocked-process reports, long-query completions, default-trace events, system_health events) is a CPU-specific marker, so the panels carry noannotationskey.get_top_queries_by_cpu,get_top_procedures_by_cpuandget_cpu_scheduler_pressuredeclare nolimitparam in the read catalog (the first two cap withtopinstead, the last has no row cap at all), so they're added tos_authoredLimitlessTrendReadsalongsideget_deadlock_trend.Two pre-existing tests hardcoded "High CPU" as an example of a metric that stays on the mechanical fallback path; both are updated to use "Poison Wait" instead, which still routes mechanically:
AlertNotebookAuthoredTemplateTests.AuthoredTemplate_NonAuthoredMetric_StaysMechanicalAlertNotebookEndpointTests.AuthenticatedRequest_ReturnsTheDocumentedNotebookShapeAlertNotebookAuthoredTemplateTests.Budget_ReadCellsHaveLimitsExceptTheTrendRead_ComposedWindowsAreAtMost24h(part of the shared theories, data-driven off the registration table) is extended with the sametop-instead-of-limit/ no-cap exceptions for the three new reads.Test plan
New file
Darling.Tests/AlertNotebookTemplateCpuTests.cs(3 tests): routing toauthored/cpu, the exact 7-cell list with both engines' panels titled and sourced correctly, and the no-matched-incident degrade (same cell count, still validates).origin/dev(detached worktree): all 3 new tests fail —AuthoredTemplate("High CPU")returns null there (no registration row yet).Darling.Tests.dll, no live PG needed — these are pure):AlertNotebookTemplateCpuTests: 3/3 pass.AlertNotebookAuthoredTemplateTests(shared theories, now covering "High CPU" via itsMemberData): 40/40 pass.AlertNotebookEndpointTests: 29/29 pass.DocCommentHygieneTests: 77/77 pass.Darling.Tests.csprojandLite.Tests.csproj(-p:EnableWindowsTargeting=true). Both targetnet10.0-windowsand cannot run here; CI decides them.CHANGELOG entry
SECTION: Added
ENTRY:
REF:
[#4420]: #4420