Repository navigation
Add authored alert notebooks for Long-Running Query and Forced Plan Failing (#4223) - #4418
Merged
Merged
Conversation
erikdarlingdata
marked this pull request as ready for review
September 26, 2026 13:43
erikdarlingdata
deleted the
fix/4223-notebook-long-query-forced-plan
branch
September 26, 2026 13:43
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
Long-Running Query and Forced Plan Failing alerts opened the mechanical fallback notebook (a plain list of the triage endpoint's reads for the metric) instead of an authored one shaped for what each alert is actually about.
What changes
New file
AlertNotebookEndpoint.Templates.QueryPlans.csadds two builders and registers both metrics with one row each ins_authoredTemplates.get_active_queries(limit 25), a markdown note that the plan for a still-running session is one click away in that row, a completion-duration timeline (long_query_completions),get_long_query_completions(limit 20)get_plan_corrections(limit 25, full text), a plan-corrections timeline byrecommendation_state(plan_correction/plan_correction_captures)get_plan_xmlrequires a concretequery_hash. NeitherAlertIncidentnor the persisted alert-history row carries that hash as data —LongRunningQueryIncidentsfolds it into the fingerprint's dedup key instead of exposing it — so the notebook cannot bind an auto-run cell to it. The template omits the read and adds a markdown note pointing at the click-through in theget_active_queriesrow instead. A pin (LongRunningQuery_NeverEmitsAGetPlanXmlCell) checks this stays true.get_query_store_regressionsis the issue's own click-to-run read. The notebook schema (DarlingWebEndpoints.ValidateNotebookDefinition) has no non-auto-run cell type — everyreadcell runs on open — so the template omits it entirely rather than running it eagerly against the issue's stated intent. A pin (ForcedPlanFailing_NeverEmitsGetQueryStoreRegressionsAsAnAutoRunCell) checks it never appears as a read cell.Test plan
New file
AlertNotebookTemplateQueryPlansTests.cs(8 tests): routing for both metrics, the exact cell list for each, thequery_hashnon-binding pin, theget_query_store_regressionsnon-auto-run pin, and a no-matched-incident degrade with the same cell count for each family.origin/dev(5899b85): all 8 new tests fail to compile/run —AlertNotebookEndpoint.AuthoredTemplatereturns null for both metrics (unregistered), confirmed by building the new test file alone against a detachedorigin/devworktree.AlertNotebookTemplateQueryPlansTests(8/8), plus the shared theoriesAlertNotebookAuthoredTemplateTests,AlertNotebookEndpointTests,DocCommentHygieneTests— 162/162, 0 failed.Darling.Tests.csprojandLite.Tests.csprojboth build 0 warnings-relevant/0 errors with-p:EnableWindowsTargeting=true. Both targetnet10.0-windows: they build here but cannot run on macOS; CI decides them.CHANGELOG entry
SECTION: Added
ENTRY:
REF:
[Add authored alert notebooks for Long-Running Query and Forced Plan Failing (#4223) #4418]: Add authored alert notebooks for Long-Running Query and Forced Plan Failing (#4223) #4418