Skip to content

FinOps Server Inventory: decouple from sys.dm_os_sys_info; surface hardware gap (#1535) - #1592

Merged
erikdarlingdata merged 3 commits into
devfrom
feature/1535-finops-inventory-detection
Jul 20, 2026
Merged

erikdarlingdata merged 3 commits into
devfrom
feature/1535-finops-inventory-detection

Conversation

@erikdarlingdata

Copy link
Copy Markdown
Owner

What

Follow-up to #1589 (which fixed the connectivity probe but explicitly left the FinOps inventory display queries coupled to sys.dm_os_sys_info). On Azure SQL DB that DMV needs VIEW DATABASE STATE; a monitoring login without it made the whole GetServerPropertiesLiveAsync query throw, so the FinOps Server Inventory grid dropped the server's entire row (edition, version, storage — everything) and only wrote an AppLogger.Error.

Fix (both Lite and the deprecated Full Dashboard)

  • Each GetServerPropertiesLiveAsync is split into two pinned const queries:
    • InventoryQueryText — every permission-free fact (edition CASE, SERVERPROPERTY scalars, engine-edition-aware dynamic-SQL storage), hardware columns replaced by typed NULLs, no FROM sys.dm_os_sys_info. Succeeds for any connected login.
    • HardwareQueryTextSELECT cpu_count, physical_memory_kb/1024, sqlserver_start_time, socket_count, cores_per_socket FROM sys.dm_os_sys_info, in its own try/catch; overwrites the hardware fields on success, sets HardwareUnavailableReason on failure. The row still renders edition/version/storage.
    • The inventory reader is scoped closed before the hardware read opens (the connection has no MARS — the Decouple SQL edition detection from sys.dm_os_sys_info - Azure SQL DB mis-detected as on-prem (#1535) #1589 lesson).
  • Dashboard inventory storage additionally stops hard-coding sys.master_files (absent on Azure SQL DB) — it now uses the same EngineEdition = 5 ? sys.database_files : sys.master_files branch Lite already had, so the Dashboard query is Azure-safe end to end (identical work, both apps).

Visibility

  • A non-alarming amber "Hardware Note" column in both FinOps Server Inventory grids, shown (with full text on hover) only when hardware inventory was denied.
  • Dashboard MCP get_server_properties returns hardware_unavailable_reason.
  • README documents that VIEW DATABASE STATE is what enables the sys.dm_os_* hardware inventory on Azure SQL DB, and that edition/version/storage degrade gracefully without it.

Tests / verification

  • New FinOpsInventoryQueryTests regression guard in each app pins the split (inventory carries no dm_os_sys_info + still carries SERVERPROPERTY('EngineEdition') + sys.database_files; hardware carries sys.dm_os_sys_info).
  • Full solution builds clean (0 errors). Lite.Tests 1434/0, Dashboard.Tests 768/0 (re-run locally). No Darling code changed.

Advances the FinOps follow-up tracked in #1535.

🤖 Generated with Claude Code

erikdarlingdata and others added 3 commits July 20, 2026 12:47
…are gap (#1535)

Follow-up to #1589 (which fixed the connectivity probe but explicitly left the
FinOps inventory display queries untouched). Split GetServerPropertiesLiveAsync
in Lite and the deprecated Full Dashboard into a permission-free
InventoryQueryText plus a best-effort HardwareQueryText read of
sys.dm_os_sys_info. On Azure SQL DB that DMV needs VIEW DATABASE STATE; without
it the old combined query threw and the FinOps Server Inventory grid lost the
server's entire row (edition, version, storage - everything). Now
edition/version/storage always render, and a non-alarming amber "Hardware Note"
column shows why CPU/memory/socket facts are missing when the DMV read is denied.

Also makes the Dashboard inventory storage Azure-safe: an engine-edition branch
reads sys.database_files on Azure SQL DB (mirroring Lite) instead of hard-coding
the Azure-absent sys.master_files, so the inventory query is Azure-safe end to end.

- Lite/Dashboard: two-step read with the inventory command+reader scoped closed
  before the hardware read opens (connections have no MARS). New
  HardwareUnavailableReason on both models, bound to an amber note column beside
  the hardware fields in both FinOps grids; Dashboard MCP get_server_properties
  also returns hardware_unavailable_reason.
- Regression-guard tests (Lite.Tests + Dashboard.Tests): InventoryQueryText
  carries no dm_os_sys_info and still carries SERVERPROPERTY('EngineEdition');
  HardwareQueryText carries sys.dm_os_sys_info.
- README: document that VIEW DATABASE STATE enables the sys.dm_os_* hardware
  inventory on Azure SQL DB (edition/version/storage still show without it).
- CHANGELOG [Unreleased] > Fixed (#1592).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The [#1578] and [#1536] reference definitions were glued onto one line
(pre-existing, unrelated to #1592), so [#1536] never resolved. Split
them while touching this file for the #1592 entry.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ventory-detection

# Conflicts:
#	CHANGELOG.md
@erikdarlingdata
erikdarlingdata merged commit 8ef9387 into dev Jul 20, 2026
2 checks passed
@erikdarlingdata
erikdarlingdata deleted the feature/1535-finops-inventory-detection branch September 12, 2026 20:29
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