Per-database exclusions for collectors — Lite side (closes #887)#906
Merged
erikdarlingdata merged 1 commit intodevfrom Apr 28, 2026
Merged
Conversation
Lite-side companion to PR #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
Lite-side companion to PR #905. Gives Lite users the same per-server "skip these databases" feature now available in the Dashboard — but stored client-side since Lite doesn't install on targets.
Storage
Collector wiring (9 collectors)
`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`
UI
Test plan
Closes #887 (paired with #905 for Dashboard).