Skip to content

Lite: add Latches & Spinlocks viewer tab (Tier-1 parity BUILD)#1504

Merged
erikdarlingdata merged 2 commits into
devfrom
feature/lite-latch-spinlock-tab
Jul 13, 2026
Merged

Lite: add Latches & Spinlocks viewer tab (Tier-1 parity BUILD)#1504
erikdarlingdata merged 2 commits into
devfrom
feature/lite-latch-spinlock-tab

Conversation

@erikdarlingdata

Copy link
Copy Markdown
Owner

What

Ports the Darling viewer's consolidated Latches & Spinlocks per-server tab to Lite. Lite already collected latch_stats (sys.dm_os_latch_stats) and spinlock_stats (sys.dm_os_spinlock_stats) but had no viewer surface — the coverage pin from #1499 currently allow-lists them as unbuilt UI. This closes that parity-board Tier-1 gap.

Tab

New top-level tab, index 13 (between Daily Summary and Collection Health — mirroring Darling's diagnostics-tail placement). Consolidated layout copied from Darling:

  • Latch wait-time trend (ms/sec) for the top 5 latch classes, above a collapsed Expander with the per-class latest-snapshot grid.
  • Spinlock collisions trend (collisions/sec) for the top 5 spinlocks, above a collapsed Expander with the per-spinlock latest-snapshot grid.

Reader (LocalDataService.LatchSpinlock.cs)

4 DuckDB readers (2 trend, 2 snapshot) mirroring the Darling Postgres reads, run against the v_latch_stats / v_spinlock_stats archive views. Per-second rates are computed in SQL from the per-contender LAG interval — the same date_trunc/extract(epoch)/LAG idiom the Wait Stats trend uses (the delta tables carry no stored sample_interval_seconds).

Rendering (ServerTab.LatchSpinlock.cs)

Mirrors Darling's rendering using Lite's chart idioms: shared ChartStyle/ChartHoverHelper, cycling SeriesColors, Y-floor-at-0 (SetChartYLimitsWithLegendPadding), UtcOffsetMinutes display conversion, zero-line-when-empty — matching Lite's other multi-series trend charts (e.g. Lock Wait Trend). Series ordered by total desc so the heaviest contender takes the first palette colour; long class/spinlock names clipped to 20 chars in the legend.

Wiring

TabControl + RefreshVisibleTabAsync switch (case 13, Collection Health shifted to case 14) + DataGridFilterManagers for both grids (Lite's grid convention: column-filter-button headers).

Coverage pin

latch_stats / spinlock_stats removed from CollectorViewerCoverageTests.KnownStoreOnlyOrUnbuiltTables (now 5 entries). The ratchet now requires the reader: with the two no longer allow-listed, EveryCollectorTable_HasALiteReader_OrIsAllowListed only passes because the new reader references the v_ views, and AllowList_HasNoEntryThatIsActuallyRead would go red if the entries were left behind.

Validation

  • dotnet build Lite/PerformanceMonitorLite.csproj -c DebugBuild succeeded, 0 errors.
  • dotnet test Lite.Tests1135 passed, 0 failed, 0 skipped, including the 3 coverage-pin tests green with the shrunk allow-list.

Visual sign-off (Erik) is the final gate, as with the other viewer tabs.

🤖 Generated with Claude Code

erikdarlingdata and others added 2 commits July 12, 2026 20:00
Port the Darling viewer's consolidated Latches & Spinlocks per-server tab
to Lite. Lite already collected latch_stats (sys.dm_os_latch_stats) and
spinlock_stats (sys.dm_os_spinlock_stats) but had no viewer surface.

New top-level tab (between Daily Summary and Collection Health, index 13):
the latch wait-time trend (ms/sec) and spinlock collisions trend
(collisions/sec) for the TOP 5 contenders stack vertically, each above a
collapsed Expander holding its per-class latest-snapshot grid.

- LocalDataService.LatchSpinlock.cs: 4 DuckDB readers (2 trend, 2 snapshot)
  mirroring the Darling Postgres reads, against the v_latch_stats /
  v_spinlock_stats archive views. Per-second rates via the per-contender
  LAG interval (the Wait Stats trend idiom).
- ServerTab.LatchSpinlock.cs: tab code-behind mirroring Darling's rendering
  with Lite's chart idioms (shared ChartStyle/ChartHoverHelper, SeriesColors,
  Y-floor-at-0, UtcOffsetMinutes display conversion).
- Wired into the TabControl + RefreshVisibleTabAsync switch + filter managers.
- Coverage pin: remove latch_stats/spinlock_stats from the allow-list (now 5);
  the ratchet now requires the reader.

Lite build clean; Lite.Tests 1135/1135 green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@erikdarlingdata erikdarlingdata merged commit b874f6c into dev Jul 13, 2026
2 checks passed
@erikdarlingdata erikdarlingdata deleted the feature/lite-latch-spinlock-tab branch July 13, 2026 00:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant