Skip to content

Enrich database_size_stats with drive-level volume space#472

Merged
erikdarlingdata merged 1 commit intodevfrom
feature/drive-space-enrichment
Mar 8, 2026
Merged

Enrich database_size_stats with drive-level volume space#472
erikdarlingdata merged 1 commit intodevfrom
feature/drive-space-enrichment

Conversation

@erikdarlingdata
Copy link
Owner

Summary

  • Adds volume_mount_point, volume_total_mb, volume_free_mb to database_size_stats via CROSS APPLY sys.dm_os_volume_stats()
  • Every file row now carries its drive context — answers "is the drive full?" alongside "how big is this file?"
  • Azure SQL DB gets NULLs (DMV not available there)
  • Lite DuckDB schema v17 migration adds columns to existing databases

Files changed

  • install/02_create_tables.sql, 06_ensure_collection_table.sql, 52_collect_database_size_stats.sql — SQL schema + collector
  • upgrades/2.1.0-to-2.2.0/06_add_volume_stats_columns.sql — upgrade script for existing installs
  • Lite/Database/Schema.cs, DuckDbInitializer.cs — DuckDB schema + v17 migration
  • Lite/Services/RemoteCollectorService.DatabaseSize.cs — Lite collector with volume stats

Test plan

  • Deployed upgrade script + collector on sql2022, ran with @debug = 1
  • 39 rows collected, all with C:\ volume data (409 GB total, 135 GB free)
  • Lite builds clean (0 warnings)
  • Launch Lite, verify collector runs without errors

🤖 Generated with Claude Code

…olume_stats

Adds volume_mount_point, volume_total_mb, volume_free_mb to the database_size_stats
collector so every file row carries its drive context. On-prem uses CROSS APPLY
sys.dm_os_volume_stats(); Azure SQL DB gets NULLs (DMV not available).

Tested on sql2022: 39 rows, all with C:\ volume data (409 GB total, 135 GB free).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@erikdarlingdata erikdarlingdata merged commit b050e6e into dev Mar 8, 2026
7 checks passed
@erikdarlingdata erikdarlingdata deleted the feature/drive-space-enrichment branch March 8, 2026 01:02
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