You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Report unattributed CPU on the top-queries reads — ranked-query CPU vs the box's measured CPU-seconds #2320
The last unshipped item from #2235's wishlist, split out on that issue's close.
The ask:get_top_queries_by_cpu (and the procedures twin) should report what fraction of the instance's actually-consumed CPU the ranking explains: sum the returned rows' windowed CPU, divide by measured CPU-seconds for the same window (cpu_utilization is already collected — SQL-process % × core count × window), and return both the numerator and the ratio, e.g. attributed_cpu_ratio: 0.32 with a one-line note when it's low.
Pre-Credit a newly compiled plan's counter instead of discarding it (#2235) #2290, the reads explained ~10% of the box and nothing said so — a caller assumed the ranking explained everything and chased the visible 10%. Post-fix the top-10 explains roughly a third; still worth surfacing, since plan-cache attribution can never reach 100% (evictions between snapshots, zero-cost rows, non-query CPU).
It is exactly the number that catches an impossible claim at a glance: the Datadog comparison died the moment someone divided its worker_time sum by the box's available CPU-seconds and got 137%. Our own tools should hand the caller that denominator instead of leaving it to be re-derived.
Sketch: the window's CPU-seconds comes from the existing cpu_utilization series (avg sql_server_cpu% over the window × cores × seconds); cores from server_properties. Both stores hold all three pieces. Denominator gaps (cpu_utilization missing for part of the window) should degrade to omitting the ratio, never to a made-up one.
Shipped in 2ceaaa9 (#2330): get_top_queries_by_cpu and get_top_procedures_by_cpu (both SKUs) now return cpu_attribution — the returned rows' summed CPU-seconds, the SQL process's measured CPU-seconds for the window (avg cpu_utilization × core count × window), and attributed_cpu_ratio. Under half, the note explains where unattributable CPU goes; above the process's own measured consumption it flags the impossible claim (the 137% marker). The degrade rule is exactly as specified: missing CPU series, missing core count, or coverage under 90% of the window omits the ratio rather than inventing one. One computation in PerformanceMonitor.Common, decision-table pinned identically in both test projects. In the next nightly; rides the upcoming release.
Activity
cpu_attribution on the top-CPU rankings: what fraction of the box the…
erikdarlingdata commentedon Aug 18, 2026
Shipped in 2ceaaa9 (#2330):
get_top_queries_by_cpuandget_top_procedures_by_cpu(both SKUs) now returncpu_attribution— the returned rows' summed CPU-seconds, the SQL process's measured CPU-seconds for the window (avgcpu_utilization× core count × window), andattributed_cpu_ratio. Under half, the note explains where unattributable CPU goes; above the process's own measured consumption it flags the impossible claim (the 137% marker). The degrade rule is exactly as specified: missing CPU series, missing core count, or coverage under 90% of the window omits the ratio rather than inventing one. One computation inPerformanceMonitor.Common, decision-table pinned identically in both test projects. In the next nightly; rides the upcoming release.