Repository navigation
procedure_stats runs per database on Azure SQL Database (#1833) - #1838
Conversation
On Azure, procedure_stats was one of two database-scoped collectors that never opted into the per-database connection path (RunsPerDatabase). It ran once on the server entry's own connection - whose catalog defaults to master when the entry's Database field is blank - and the Azure variant's WHERE s.database_id = DB_ID() then matched only master's procedures: zero user rows, logged SUCCESS, an empty Top Procedures grid that looked healthy, while Top Queries (per-database) kept working next to it. The override mirrors query_stats and the five other database-scoped collectors (=> target.IsAzureSqlDb). The Azure query needs no change: the per-database connection makes DB_ID() each user database in turn, which is exactly what that predicate was written for. Shared definition, so Lite and Darling both get it. Query Store has the same gap but needs a per-database rework on Azure (enumeration + per-item shape) - filed as #1836. The Collection Health gap that hid both defects (zero items enumerated logs SUCCESS) is #1837. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ReviewSmall, well-scoped fix — verified against the codebase, not just the diff. Correctness: Confirmed. Test coverage: The new Watermark: Lite/Darling parity: No drift risk. CHANGELOG: Entry follows the established format and correctly cross-references the two follow-up issues (#1836, #1837) filed for the related gaps. No issues found. LGTM. |
Summary
Half of #1833 (the Top Procedures grid; Query Store is the design-sized half, filed as #1836). On Azure SQL DB,
procedure_statswas one of only two database-scoped collectors that never opted into the per-database connection path — verified by enumerating everyRunsPerDatabaseoverride in the collectors project. It ran once on the server entry's own connection (catalog defaults tomasterwith a blank Database field), where its Azure variant'sWHERE s.database_id = DB_ID()matched only master's procedures: zero user rows,SUCCESSlogged, an empty grid that looked healthy — while Top Queries, which does run per database, worked right next to it. That asymmetry is what fingerprinted the bug in triage.The fix is the same one-line override its six database-scoped siblings already carry (
RunsPerDatabase => target.IsAzureSqlDb). The Azure query needs no change — the per-database connection makesDB_ID()mean each user database in turn, which is exactly what that predicate was written for. Shared definition: Lite and Darling both get it. Follow-ups filed: #1836 (Query Store on Azure needs an enumeration→per-database rework), #1837 (zero-items-enumerated logs SUCCESS — the Collection Health gap that hid both defects).Test plan
RunsPerDatabase_OnAzureOnlypin: true on Azure SQL DB, false on-prem and on Managed InstanceProcedureStatsCollectorDefinitionTests: 11/11 pass; build 0 warnings🤖 Generated with Claude Code