Per-database exclusions for collectors — Dashboard side (#887)#905
Merged
erikdarlingdata merged 1 commit intodevfrom Apr 28, 2026
Merged
Per-database exclusions for collectors — Dashboard side (#887)#905erikdarlingdata merged 1 commit intodevfrom
erikdarlingdata merged 1 commit intodevfrom
Conversation
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) <noreply@anthropic.com>
This was referenced Apr 28, 2026
pull Bot
pushed a commit
to ehtick/PerformanceMonitor
that referenced
this pull request
Apr 29, 2026
Lite-side companion to PR erikdarlingdata#905 — gives users a per-server way to skip specific databases in the per-database collectors. Storage: ExcludedDatabases (List<string>) added to ServerConnection, persisted via the existing servers.json round-trip. Lite doesn't install on targets, so the list lives client-side instead of in a remote config.collector_database_exclusions table the way Dashboard does it. Wiring: 9 collectors get the filter — query_stats, query_store, procedure_stats, query_snapshots, file_io_stats, waiting_tasks, database_configuration, database_scoped_configurations, database_size. Azure-mode collectors that route through GetAzureDatabaseListAsync get exclusions automatically since the helper now applies the filter centrally. Two SQL helpers on RemoteCollectorService: - BuildDatabaseExclusionFilter — parameterized AND <col> NOT IN (@excl_db_N). Used by every collector whose query is plain (non-dynamic) T-SQL. No compatibility-level dependency (avoids OPENJSON / STRING_SPLIT which require compat 130+ on the connection database). - BuildDatabaseExclusionLiteralClause — N'name' literals with single-quote escaping (and a forNestedDynamicSql=true mode that doubles the escape). Used by procedure_stats which builds @SQL then passes to sp_executesql, where parameter binding inside the dynamic statement is awkward. Names come from a user-picked checklist, so literal interpolation with proper escaping is safe. UI: ManageServersWindow gets a new "Excluded Databases" button between Edit and Delete. Right-click context menu now mirrors the buttons — Edit / Excluded Databases / Delete on top, then the existing Copy/Export items below a separator. New ExcludedDatabasesDialog mirrors the Dashboard version: live-queries sys.databases, hides system DBs, pre-checks current exclusions, shows stale entries (in list but not on server) greyed with "(missing)" tag. Save calls ServerManager.UpdateServer to persist via servers.json. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
First half of #887. Adds a per-server, user-configurable list of databases to skip in the eight per-database collectors that iterate `sys.databases`.
What's in this PR
Not in this PR
Lite side. Lite stores the exclusion list in `servers.json` (no install on the target = no `config.collector_database_exclusions` table to use), and the collector queries are built C#-side, so the integration looks different. Following up as a separate PR.
Test plan
Closes #887 when paired with the Lite follow-up PR.