Repository navigation
Fleet overview: an Azure master's deadlock last-seen comes from its own databases, and the Viewer card shows no sibling's Last - #4932
Merged
Conversation
…dlock of its own databases
…atabases, like its counts
…every stored graph on each refresh
…t-seen docs say what a master shows
erikdarlingdata
marked this pull request as ready for review
October 2, 2026 02:41
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.
Follow-up to #4925.
What was wrong
#4925 scoped an Azure SQL Database master's blocking and deadlock counts to its own databases, but left the "last seen" times alone. A master whose own databases had no deadlocks still showed "0 deadlocks, last seen minutes ago" on the fleet card (
/api/fleet, MCPget_fleet_overview), because the time came from a separately monitored database's deadlock. The Darling Viewer's Overview card did the same: under 0 blocking and 0 deadlocks it read "Last: 2m ago" from a sibling's event.The fix
PgFactCollector.CountAndNewestDeadlocksSkippingSeparateAsyncreturns the scoped deadlock count AND the newest deadlock that count includes, in ONE pass, with the count's own rule: the outside rows giveCOUNT(*)andMAX(deadlock_time)in SQL, and each graph that counts (not every process in a separately monitored database) adds to the count and to the newest. Its statements have the same predicates, window, collection floor and parameters as the count-only statements, so the count is unchanged.CountDeadlocksSkippingSeparateAsyncis unchanged (the anomaly detector uses it).DarlingFleetReader.ReadAzureMasterScopedCountsAsyncmakes that one call, and the fleet card'sdeadlock_last_seentakes the scoped time. The counts and the time come from the same read, so a failure can't separate them: a throw keeps that master's whole unscoped row, as before. MCPget_server_summary(which has no last-seen field) now makes one graph pass instead of two.get_server_summaryhas no last-seen field. Lite's card shows no "Last", so Lite is unchanged. The web fleet page shows a last-seen only when the count is above 0.Pins
FleetOverviewAzureMasterScopeLiveTests.MasterCard_DeadlockLastSeen_IsTheNewestOfItsOwnDatabases: with a sibling's deadlock newer than master's own, master's card shows its own newest (and null when it has none).TheCombinedDeadlockPass_AgreesWithTheCountOnlyPass_AndFindsTheNewestCounted: an outside row, an all-in graph, a mixed graph, a graph with no database and a row with no event time; the count equals the count-only method's, the newest is the newest counted row, and a newer all-in graph is skipped.TheScopedCounts_MakeOneDeadlockPass: the scoped reads call the combined method once.ViewerFleetAzureMasterScopeLiveTests.TheMastersCard_ShowsNoLastForBlockingOrDeadlocks: a scoped master under 0/0 with newer sibling events has no "Last" in either detail, also when a scoped read fails; after a failed list lookup it keeps the unscoped "Last"; a plain server and a master with no siblings keep theirs; the counts are unchanged.Tests run
ViewerFleetAzureMasterScopeLiveTests(12),FleetOverviewAzureMasterScopeLiveTests(12),AzureMasterAnalysisScopeLiveTests(21),DarlingMcpHealthToolsLivePostgresTests(2),DarlingFleetReaderSqlTests(33),DarlingFleetDeadlockCoverageTests(23),ViewerOverviewSqlTests(11),ViewerFleetDeadlockCoverageTests(29),McpPayloadContractCensusTests(68),ViewerDailySummaryAzureMasterScopeLiveTests(3),StorageCommandTimeoutTests,McpReadCommandTimeoutTests, and the T-SQL, doc-comment, repo-file and deadline-scanner guards.CHANGELOG
None: part of the fleet overview's Azure master entry (#4925).