From c1dcfc27170faf48dbfe1f23db5731fa6c8e4257 Mon Sep 17 00:00:00 2001 From: Erik Darling <2136037+erikdarlingdata@users.noreply.github.com> Date: Mon, 27 Apr 2026 22:29:34 -0400 Subject: [PATCH] Add per-database exclusions for collectors (Dashboard, #887) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New config.collector_database_exclusions table holds a per-server list of user databases to skip in per-database collectors. The eight collectors that iterate sys.databases now honor it via a NOT EXISTS filter: query_stats, query_store, procedure_stats, file_io_stats, waiting_tasks, database_configuration, database_size_stats, server_properties. System databases (master/tempdb/model/msdb) and the PerformanceMonitor database itself remain hardcoded skips in the collectors and are not represented in the exclusions list. Dashboard side: - Manage Servers window gets a new "Excluded Databases" button (and matching context menu entry) between Check Server Version and Purge Now. - Default window width bumped 780 → 960 so all per-row buttons fit on first open without resizing. - New ExcludedDatabasesDialog modal: live-queries sys.databases on the target, pre-checks current exclusions, hides system DBs, shows stale entries (in list but not on server) greyed and disabled with "(missing)". Save replaces the table contents transactionally. - ServerManager.GetUserDatabasesAsync, GetCollectorDatabaseExclusionsAsync, and SaveCollectorDatabaseExclusionsAsync handle the connection plumbing. Schema is added in install/01 (initial install) and mirrored in install/03 inside config.ensure_config_tables (resilient re-creation). No upgrade folder needed — installer re-runs install/01 on existing installs and the IF OBJECT_ID guard fires. Verified end-to-end by running the CLI installer against sql2019, then excluding hammerdb_tpcc and confirming database_size_stats_collector skipped it (0 rows) while StackOverflow2010 was still collected. Lite side will follow in a separate PR (different storage model — Lite keeps the exclusion list in servers.json since it doesn't install on targets). Co-Authored-By: Claude Opus 4.7 (1M context) --- Dashboard/ExcludedDatabasesDialog.xaml | 49 ++++++ Dashboard/ExcludedDatabasesDialog.xaml.cs | 150 ++++++++++++++++++ Dashboard/ManageServersWindow.xaml | 4 +- Dashboard/ManageServersWindow.xaml.cs | 19 +++ Dashboard/Services/ServerManager.cs | 109 +++++++++++++ install/01_install_database.sql | 26 +++ install/03_create_config_tables.sql | 39 +++++ install/08_collect_query_stats.sql | 7 + install/09_collect_query_store.sql | 7 + install/10_collect_procedure_stats.sql | 14 ++ install/20_collect_file_io_stats.sql | 7 + install/37_collect_waiting_tasks.sql | 7 + install/39_collect_database_configuration.sql | 14 ++ install/52_collect_database_size_stats.sql | 7 + install/53_collect_server_properties.sql | 7 + 15 files changed, 465 insertions(+), 1 deletion(-) create mode 100644 Dashboard/ExcludedDatabasesDialog.xaml create mode 100644 Dashboard/ExcludedDatabasesDialog.xaml.cs diff --git a/Dashboard/ExcludedDatabasesDialog.xaml b/Dashboard/ExcludedDatabasesDialog.xaml new file mode 100644 index 00000000..00789a61 --- /dev/null +++ b/Dashboard/ExcludedDatabasesDialog.xaml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +