Skip to content

Honor collector_database_exclusions in default trace and trace analysis collectors (#887 follow-up)#934

Merged
erikdarlingdata merged 1 commit intodevfrom
feature/887-trace-collector-exclusions
May 5, 2026
Merged

Honor collector_database_exclusions in default trace and trace analysis collectors (#887 follow-up)#934
erikdarlingdata merged 1 commit intodevfrom
feature/887-trace-collector-exclusions

Conversation

@erikdarlingdata
Copy link
Copy Markdown
Owner

Summary

Changes

  • install/29_collect_default_trace.sqlNOT EXISTS against config.collector_database_exclusions joined to sys.databases to translate the exclusion list (by name) into ids matching ft.DatabaseID from sys.fn_trace_gettable.
  • install/31_collect_trace_analysis.sqlNOT EXISTS directly on trc.DatabaseName (the .trc file exposes the name, no translation needed).

Scope check

Re-audited every Dashboard install/*collect*.sql and every Lite collector class. Confirmed:

  • These two were the only Dashboard collectors missing the filter.
  • Lite is fully covered — all 9 per-database collectors apply BuildDatabaseExclusionFilter() from RemoteCollectorService.cs. No Lite changes needed.

Test plan

  • Run the CLI installer end-to-end against a test instance and confirm 54/54 install scripts succeed.
  • Verify both procs reference config.collector_database_exclusions after install.
  • Smoke test: exclude a database that's currently producing trace/audit events (e.g. distribution), confirm default_trace_collector and trace_analysis_collector skip 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).

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>
@erikdarlingdata erikdarlingdata merged commit 1206880 into dev May 5, 2026
6 checks passed
@erikdarlingdata erikdarlingdata deleted the feature/887-trace-collector-exclusions branch May 5, 2026 15:23
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