Skip to content

Query Profiler database filter#21417

Merged
allancascante merged 20 commits into
mainfrom
dev/allancascante/profiler_database_filter
Mar 11, 2026
Merged

Query Profiler database filter#21417
allancascante merged 20 commits into
mainfrom
dev/allancascante/profiler_database_filter

Conversation

@allancascante
Copy link
Copy Markdown
Contributor

@allancascante allancascante commented Mar 2, 2026

Description

Adding option to launch from Object Explorer at database level, Extended Events are supported at server level for on-prem SQL servers; to allow filtering at database level has to be done on UI only. Adding a default filter in the UI for the selected database from which the Query Profiler is launch.

Since this is a filter at UI level, support is maintained to remove the filter if needed to allow user to see events for other databases.

image image

Code Changes Checklist

  • New or updated unit tests added
  • All existing tests pass (npm run test)
  • Code follows contributing guidelines
  • Telemetry/logging updated if relevant
  • No regressions or UX breakage

Reviewers: Please read our reviewer guidelines

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for launching Query Profiler from an Object Explorer Database node and auto-applying a DatabaseName filter in the Profiler UI (while still allowing the user to clear/modify it).

Changes:

  • Registers a new mssql.profiler.launchFromDatabase command and threads an optional database-scope filter through the profiler launch/setup flow.
  • Applies an initial DatabaseName categorical filter in the profiler webview controller when launched from a database node.
  • Updates the categorical column filter popover to surface pre-set filter values even before events arrive; expands unit test coverage.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
extensions/mssql/src/profiler/profilerController.ts Adds a database-node launch command and passes a database-scope filter into UI setup.
extensions/mssql/src/profiler/profilerWebviewController.ts Stores/applies an initial DatabaseName filter when a session starts.
extensions/mssql/src/reactviews/pages/Profiler/profilerColumnFilterPopover.tsx Merges pre-set categorical clause values into the checkbox list so defaults are visible immediately.
extensions/mssql/test/unit/profiler/profilerController.test.ts Adds unit coverage for the new launch-from-database command registration and flow.
extensions/mssql/test/unit/profiler/filteredBuffer.test.ts Adds additional filter behavior tests, including whitespace trimming and typed clause scenarios.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread extensions/mssql/src/profiler/profilerWebviewController.ts
Comment thread extensions/mssql/src/profiler/profilerController.ts
Comment thread extensions/mssql/test/unit/profiler/filteredBuffer.test.ts Outdated
Comment thread extensions/mssql/test/unit/profiler/filteredBuffer.test.ts
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 2, 2026

PR Changes

Category Target Branch PR Branch Difference
vscode-mssql VSIX 6410 KB 6410 KB ⚪ 0 KB ( 0% )
sql-database-projects VSIX 7061 KB 7061 KB ⚪ 0 KB ( 0% )
data-workspace VSIX 535 KB 535 KB ⚪ 0 KB ( 0% )

Copilot AI review requested due to automatic review settings March 2, 2026 21:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread localization/xliff/vscode-mssql.xlf Outdated
Comment thread extensions/mssql/test/unit/profiler/profilerController.test.ts
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 2, 2026

Codecov Report

❌ Patch coverage is 80.00000% with 34 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.72%. Comparing base (bef06cd) to head (9babef2).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
...ns/mssql/src/profiler/profilerWebviewController.ts 74.56% 29 Missing ⚠️
...xtensions/mssql/src/profiler/profilerController.ts 90.19% 5 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #21417      +/-   ##
==========================================
+ Coverage   72.68%   72.72%   +0.03%     
==========================================
  Files         331      331              
  Lines       98504    98553      +49     
  Branches     5465     5476      +11     
==========================================
+ Hits        71595    71670      +75     
+ Misses      26909    26883      -26     
Files with missing lines Coverage Δ
...nsions/mssql/src/profiler/profilerConfigService.ts 99.49% <100.00%> (+<0.01%) ⬆️
...xtensions/mssql/src/profiler/profilerController.ts 49.38% <90.19%> (+1.64%) ⬆️
...ns/mssql/src/profiler/profilerWebviewController.ts 64.04% <74.56%> (+2.13%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI review requested due to automatic review settings March 6, 2026 17:24
Copilot AI review requested due to automatic review settings March 6, 2026 22:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread extensions/mssql/package.json
@allancascante allancascante added this to the March 2026 Release milestone Mar 6, 2026
aasimkhan30
aasimkhan30 previously approved these changes Mar 9, 2026
Comment thread extensions/mssql/package.json
Comment thread extensions/mssql/src/profiler/profilerWebviewController.ts
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread extensions/mssql/src/profiler/profilerController.ts
Comment thread extensions/mssql/package.json
Comment thread extensions/mssql/src/profiler/profilerWebviewController.ts Outdated
Comment thread extensions/mssql/test/unit/profiler/profilerController.test.ts Outdated
Comment thread extensions/mssql/test/unit/profiler/profilerController.test.ts Outdated
Copilot AI review requested due to automatic review settings March 11, 2026 00:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread extensions/mssql/package.json
Copilot AI review requested due to automatic review settings March 11, 2026 21:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +44 to +51
function createStubbedVscodeWrapper(
sandbox: sinon.SinonSandbox,
): sinon.SinonStubbedInstance<VscodeWrapper> {
const stub = sandbox.createStubInstance(VscodeWrapper);
stub.getConfiguration.returns({
get: sandbox.stub().returns(10000),
} as unknown as vscode.WorkspaceConfiguration);
return stub;
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

createStubbedVscodeWrapper doesn't stub the outputChannel getter. Since ProfilerController calls Logger.create(this._vscodeWrapper.outputChannel, ...), a stubbed VscodeWrapper created via sandbox.createStubInstance(VscodeWrapper) will return VscodeWrapper._outputChannel (likely undefined because the constructor never ran), causing Logger.create to throw when it calls channel.append(...).

To keep these tests isolated and non-order-dependent, stub outputChannel on the wrapper (e.g. return an object with append/appendLine stubs) or instantiate a real VscodeWrapper with vscode.window.createOutputChannel stubbed.

Copilot uses AI. Check for mistakes.
@allancascante allancascante merged commit 6ee5847 into main Mar 11, 2026
2 of 3 checks passed
@allancascante allancascante deleted the dev/allancascante/profiler_database_filter branch March 11, 2026 22:11
allancascante added a commit that referenced this pull request Mar 11, 2026
* refactor to filtering parse types in both filters and columns values

* refactor on method signature used by sorting functionality

* Update extensions/mssql/src/profiler/profilerConfigService.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update extensions/mssql/src/profiler/profilerWebviewController.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Adding launch from OE for databases to include a filter at database level

* reverting changes from merge

* reverting merged changes adding duplicate tests

* removing duplicate test

* fix for azure database launch

* reverting unwanted changes

* PR comment

* test refactor

* adding constant

* test changes

* tests updates

* making note to unit test instructions for agents

---------

Co-authored-by: Allan Cascante <acascante@microsoft.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
allancascante added a commit that referenced this pull request Mar 11, 2026
* refactor to filtering parse types in both filters and columns values

* refactor on method signature used by sorting functionality

* Update extensions/mssql/src/profiler/profilerConfigService.ts



* Update extensions/mssql/src/profiler/profilerWebviewController.ts



* Adding launch from OE for databases to include a filter at database level

* reverting changes from merge

* reverting merged changes adding duplicate tests

* removing duplicate test

* fix for azure database launch

* reverting unwanted changes

* PR comment

* test refactor

* adding constant

* test changes

* tests updates

* making note to unit test instructions for agents

---------

Co-authored-by: Allan Cascante <acascante@microsoft.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

[Feature Request]: Enhanced Database-Level Profiler Launch with Automatic Filtering

5 participants