Repository navigation
Log each tab's first load and draw Performance Trends charts as their reads land (#9232) - #9239
Open
erikdarlingdata wants to merge 2 commits into
Open
erikdarlingdata wants to merge 2 commits into
erikdarlingdata wants to merge 2 commits into
Conversation
erikdarlingdata
marked this pull request as ready for review
November 21, 2026 07:58
There was a problem hiding this comment.
Verdict: LGTM
Claims
- VERIFIED — One INFO line per first load of a tab and of each Queries sub-tab, written once —
Lite/Helpers/TabFirstLoad.csRunAsync(the_loadedset, then_write); wired inServerTab.Refresh.csRefreshVisibleTabAsync;TheFirstLoadOfATab_WritesOneLine_WithTheElapsedMilliseconds. - VERIFIED — A load a newer request superseded is not counted, so its replay gets the line —
RunAsyncreturns before_loaded.Addwhenabandoned()is true; the call site passes() => ct.IsCancellationRequested;ALoadANewerRequestAbandoned_IsNotAFirstOpen_SoItsReplayGetsTheLine. - VERIFIED — A load that throws writes no line and the next load is still the first — the exception propagates before
_loaded.Add;ALoadThatThrows_WritesNoLine_AndTheNextLoadIsStillTheFirst. - VERIFIED — Performance Trends draws each chart when its own read and the discontinuity read land; reads, SQL and chart code unchanged — the diff replaces the
WhenAllplus four sequentialUpdate*Chartcalls with fourLandedPanels.DrawAsynccalls over the same tasks;APanel_IsDrawnWhenItsOwnReadLands_WithoutWaitingForASlowerPanel. - VERIFIED — No SQL changed — the diff touches no SQL.
- VERIFIED — The switch text and the name
RefreshVisibleTabAsyncare kept —switch (MainTabControl.SelectedIndex)is still present inside the lambda. - UNVERIFIED — The timings table (all reads under 2.5 s on a seeded store) — needs a live run on a seeded store.
- UNVERIFIED — The tests pass and the revert proof holds — needs a build and a test run.
- UNVERIFIED — The two call sites in
ServerTab.Refresh.cswork in the app — WPF cannot run in this read-only tree. The body says the same.
Riskiest lines
- Lite/Controls/ServerTab.Refresh.cs:427-436 — the key and label are built from the selected index before the load, so a tab switch mid-load could mislabel the line — UNCOVERED (WPF; the body says so). The
ctabandonment check is the guard. - Lite/Controls/ServerTab.Refresh.cs:560-568 — the four draws now run independently, so if one read throws, the other charts draw before
WhenAllsurfaces the exception, where before none drew — UNCOVERED (the helper tests cover only the helper). - Lite/Helpers/TabFirstLoad.cs:44-56 — the
_loadedset is unsynchronized; this is safe only because the call is on the UI thread — covered byALaterLoadOfTheSameTab_WritesNothing_ButEachNewKeyWritesItsOwnLinefor the logic, UNCOVERED for threading.
Traps near this diff
- "A test that reads the clock twice measures the CI scheduler… One anchor owns both ends of an interval." — does not apply — the tests use a hand-moved
HandClock(TabFirstLoadTests.cs:20) and no wall-clock bounds.Eventuallypolls with a 30 s deadline for a condition, not a measurement. - "Ruling (#5833): tests are load-bearing… never add a source pin" — does not apply — all 7 new tests are behaviour tests.
- "Lite and Darling ship in parity" — does not apply — the change is to Lite's
ServerTaband Lite helpers, and the PR's scope is Lite's tab loading. I did not search Darling for a counterpart.
Divergence (blind read vs PR body)
None in substance. One behaviour the body does not mention: Overview returns its failed lanes as a value (failedReads) rather than throwing, so a first load with failed reads still writes "First load of …" and is then marked loaded. This is non-blocking. The line says the load completed, not that it succeeded.
Reviewer checklist
- Open Performance Trends in the Lite app and confirm that the charts draw one at a time and that the log has one
First load of Queries > Performance Trends: N msline. - Switch tabs mid-load and confirm the line carries the right label and that the replay is logged.
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.
Claude posting for Erik Darling.
Refs #9232. The issue stays open until the first-open time is measured again on a field install that has this change and #9235, because the reads measured here are not slow and the field wait is not reproduced.
What this changes
First load of Queries > Performance Trends: 1234 ms, written once, when that tab's reads first complete. The timer's ticks and a return to the tab write nothing. A load a newer request superseded is not counted, so its replay gets the line. The newTabFirstLoadhelper holds the decision, andRefreshVisibleTabAsynccalls it around the tab's reads (the engine-edition and data-start steps before them are not in the figure).LandedPanels). The reads, their SQL and the chart code are unchanged.What I measured
RefreshVisibleTabAsyncpasssubTabOnly: true, so the full eleven-read branch ofRefreshQueriesAsync(the one whose comment says it runs 8 queries) is not reached from the app. I left it alone: tests read its text, and nothing calls it. So the first visit to Performance Trends waits on its own five reads only, not on the other sub-tabs.The slowest single read anywhere was half a second, and the largest total was 2.5 s. The data-start and oldest-retained reads that run before every tab load took 59 ms cold and 0 ms after. Nothing here comes near 30 to 45 s, so there is no slow read to rewrite. I changed no SQL, so there is no old-versus-new equality test. I did not invent a rewrite to have one.
ConnectToServerAsynccallsserverTab.RefreshData()first, so the stored data is shown at once, and then runs every collector for the server and callsFirstCollectionFinished(), which is the only thing that replaces the status line. The 8 to 48 s is that whole first collection cycle (every collector, queued behind the other servers' starting cycles), not a data read. Parked: ending the line earlier when the store already holds the server's data changes what the header says and needs a decision on the wording (for example "Showing stored data, collecting..."). I did not measure the cycle itself, since that needs a live server, so there is no figure for it from me.Tests
Lite.Tests/TabFirstLoadTests.cs(7 tests, behaviour only, no source pins, no wall-clock bounds):Revert proof: with the first-load guard removed (every load logs),
ALaterLoadOfTheSameTab_WritesNothing_ButEachNewKeyWritesItsOwnLinefails, and with it restored all 7 pass. I did not mutate the panel helper: the old code path (await all five, then draw) is not expressible through it, so that test pins the new behaviour rather than failing on the old code. WPF cannot run in the suite, so the two call sites inServerTab.Refresh.cs(the key and label and the fourDrawAsynccalls) are exercised only by the app.Classes run (all green, 175 tests): TabFirstLoadTests, DataStartBannerQueriesTabTests, AzureSqlDatabaseCallSiteTests, AzureSqlDatabaseNotCollectedSurfaceTests, CollectorRunHistoryArchiveTests, CollectorRunHistoryReadTests, EngineGapNoteTests, OlderSkuEmptyStatesTests, RefreshCoordinatorTests, ServerTabChartCardsTests. Source pins in AzureSqlDatabaseCallSiteTests and RefreshCoordinatorTests read
RefreshVisibleTabAsync, so I kept its name, its call count and theswitch (MainTabControl.SelectedIndex)it spells.Gate (
bash .github/scripts/pre-push.sh):[guard-darling] Darling.Tests Total: 4980, Errors: 0, Failed: 0and[guard-lite] Lite.Tests Total: 1242, Errors: 0, Failed: 0, thenGATE STOP: selection is the whole suite (darling 3262, lite 1140), so the selected classes did not run there. I ran the classesci-select.py local-classeslists for Lite instead (above). The Darling classes it lists name only_time, a common field name, not anything I changed.Considered, not added
RefreshQueriesAsync: tests read its text and it is not part of this fix.Release note: Performance Trends now draws each chart as soon as its own data is read, and the Lite log gets one line the first time each tab, and each Queries sub-tab, finishes loading, with the time it took.