Honor collector_database_exclusions in default trace and trace analysis collectors (#887 follow-up)#934
Merged
erikdarlingdata merged 1 commit intodevfrom May 5, 2026
Conversation
PR #905 wired config.collector_database_exclusions into the 8 collectors that iterate sys.databases, but missed default_trace_collector and trace_analysis_collector because they filter trace events by DatabaseID/DatabaseName rather than looping sys.databases. - 29_collect_default_trace.sql: NOT EXISTS against config.collector_database_exclusions joined to sys.databases to translate the exclusion list (by name) into ids matching ft.DatabaseID. - 31_collect_trace_analysis.sql: NOT EXISTS directly on trc.DatabaseName (trace exposes the name here). 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
default_trace_collectorandtrace_analysis_collectorwere skipped in the original per-database exclusion work because they filter trace events byDatabaseID/DatabaseNamerather than iteratingsys.databases, so theNOT EXISTS (... d.name)pattern from Per-database exclusions for collectors — Dashboard side (#887) #905 didn't drop in directly.config.collector_database_exclusions, matching the behavior of the other 8 per-database collectors.Changes
install/29_collect_default_trace.sql—NOT EXISTSagainstconfig.collector_database_exclusionsjoined tosys.databasesto translate the exclusion list (by name) into ids matchingft.DatabaseIDfromsys.fn_trace_gettable.install/31_collect_trace_analysis.sql—NOT EXISTSdirectly ontrc.DatabaseName(the .trc file exposes the name, no translation needed).Scope check
Re-audited every Dashboard
install/*collect*.sqland every Lite collector class. Confirmed:BuildDatabaseExclusionFilter()fromRemoteCollectorService.cs. No Lite changes needed.Test plan
config.collector_database_exclusionsafter install.default_trace_collectorandtrace_analysis_collectorskip its events while a non-excluded DB still produces rows. Wrap in a transaction and roll back.Addresses the follow-up question on #887 (comment).