Repository navigation
Lite's perfmon chart and get_perfmon_trend set aside a one-sample Wait Statistics spike (#4476) - #4492
Merged
Conversation
) PerformanceMonitor.Common.WaitStatisticsArtifact.IsIsolatedSingleSampleArtifact is the shared test for a Wait Statistics gauge row whose value is a one-sample cumulative-count artifact: both neighbours present, value >= 1,000,000, and > 1,000x the larger neighbour, scoped to gauge rows whose object name ends in ":Wait Statistics". The read-path wiring (Viewer perfmon chart, MCP get_perfmon_stats) and pins are not yet in this commit; see the PR body for what remains.
…s from the per-collection SUM (#4476)
…-artifact' into lane-4476e-work
…t Statistics spike (#4476)
…4476) Runs the real GetPerfmonTrendsByCountersAsync and GetPerfmonBucketsAsync against an embedded DuckDB plant with the same field-shaped isolated single-sample Wait Statistics spike used by Darling's live artifact tests, proving the chart and MCP reads set the spike aside through the actual product call path instead of only a source-text scan.
# Conflicts: # Darling/PerformanceMonitor.Darling.Viewer/ViewerDataService.Perfmon.cs
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 #4476.
Why
#4476 taught the Darling side's perfmon trend reads (the desktop chart and the
get_perfmon_trendMCP tool) to recognize and set aside an isolated single-sample artifact in theSQLServer:Wait Statisticsgauge family: SQL Server intermittently hands back a counter's lifetime cumulative count for one sample instead of the level it's supposed to report, and that one row can dwarf every real value around it once several instances are summed into a chart point. Lite has its own perfmon chart and its ownget_perfmon_trendtool, reading the same shape of data through DuckDB instead of Postgres — without this change, the same spike distorts Lite's chart and its MCP answer exactly the way it used to distort Darling's.What changes
Lite/Services/LocalDataService.Perfmon.cs,PerfmonTrendsSql(the batched chart read behindGetPerfmonTrendsByCountersAsync): a raw-row layer under the per-collectionSUM, carryinglag/leadofcntr_valueper instance soWaitStatisticsArtifact.ArtifactPredicateSqlcan flag the isolated spike before the instances are summed. Every artifact row is excluded from thecntr_value/delta_cntr_valuesums viaFILTER (WHERE NOT is_artifact); the bucket layer sums the set-aside count into a new trailingartifacts_set_asidecolumn.GetPerfmonTrendsByCountersAsyncdrops a bucket whose every row was set aside rather than reading it as a fabricated 0, andPerfmonTrendPointcarries the newArtifactsSetAsidecount (0 by default).Lite/Services/LocalDataService.TrendBuckets.cs,GetPerfmonBucketsAsync(theget_perfmon_trendMCP tool's read): the same UNION ALL raw layer and FILTERed sums, now returning aPerfmonBucketsResult(Points, ArtifactsSetAside)— the published points (with a fully-set-aside bucket dropped) plus the total set-aside count across the whole window, since a dropped bucket's own count would otherwise be lost.Lite/Mcp/McpPerfmonTools.cs: passes the new total through toTrendPayloads.PerfmonTrend, soget_perfmon_trend's envelope reports a realartifacts_set_asidecount and notes line instead of always 0.Lite/Controls/ServerTab.Pickers.cs: the perfmon chart title now showsWaitStatisticsArtifact.ChartCaption(...)when any plotted counter's trend set anything aside, mirroring the Darling viewer's chart chrome.right(),GREATEST,COALESCE,FILTER, and windowlag/leadall exist unchanged in DuckDB (confirmed with the DuckDB CLI), so no dialect parameter was needed onWaitStatisticsArtifact's SQL helpers.Test plan
v_perfmon_stats, one instance spiking 318 -> 214,396,451 -> 1,021 at the second collection. Ran the exclusion SQL directly: the spike collection's SUM comes back 62 (the other three instances' shared value at that timestamp) instead of 214,396,513. See REPORT above.Darling.Tests.LitePerfmonWaitStatisticsArtifactSourceTests(2 facts, macOS + Windows CI) scans Lite's two SQL-builder source files for the sharedWaitStatisticsArtifact.ArtifactPredicateSql/ObjectNameSuffixMatchSqlcalls, thelag/leadwindow, theFILTER (WHERE NOT is_artifact)exclusion and theartifacts_set_asidecolumn — proving the SQL text is wired without needing a live DuckDB in this project.dev(which has A Wait Statistics "per second" counter occasionally stores ~98 million as a gauge and flattens the throughput chart #4476's Darling side but not Lite's wiring) — both failed with "Not found: WaitStatisticsArtifact.ArtifactPredicateSql(".falseinGetPerfmonBucketsAsync's SQL, reran the local DuckDB check — the spike leaked back through unfiltered (214,396,513). Reverted, rebuilt clean.Lite/PerformanceMonitorLite.csproj,Lite.Tests/Lite.Tests.csproj,Darling/Darling.Tests/Darling.Tests.csproj,-p:EnableWindowsTargeting=true, all 0 warnings / 0 errors.DocCommentHygieneTests+ the new pin: 79/79 passed in-process on macOS.LitePerfmonWaitStatisticsArtifactLiveTests—GetPerfmonTrendsByCountersAsync_SetsAsideTheIsolatedSpike_AndDropsAnAllArtifactCollection(collection-3 Value == 62, ArtifactsSetAside == 1, an all-artifact collection drops entirely) andGetPerfmonBucketsAsync_KeepsTheSpikeOutOfThePublishedPeak_AndReportsOneArtifact(published peak < 10,000, ArtifactsSetAside == 1). Both run the real Lite reads against an embedded DuckDB seeded with the same field-shaped plant as Darling's live artifact tests.Lite.Tests.dllitself cannot run in-process on macOS (discovery dies on WindowsBase) — built clean here (0 warnings / 0 errors); Windows CI runs them.CHANGELOG
SECTION: Fixed
ENTRY:
get_perfmon_trendalso set aside a one-sample Wait Statistics spike and say how many ([Lite's perfmon chart and get_perfmon_trend set aside a one-sample Wait Statistics spike (#4476) #4492]).REF:
[Lite's perfmon chart and get_perfmon_trend set aside a one-sample Wait Statistics spike (#4476) #4492]: Lite's perfmon chart and get_perfmon_trend set aside a one-sample Wait Statistics spike (#4476) #4492