Query Profiler database filter#21417
Conversation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
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.launchFromDatabasecommand and threads an optional database-scope filter through the profiler launch/setup flow. - Applies an initial
DatabaseNamecategorical 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.
PR Changes
|
There was a problem hiding this comment.
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.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ 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
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| 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; |
There was a problem hiding this comment.
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.
* 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>
* 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>
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.
Code Changes Checklist
npm run test)Reviewers: Please read our reviewer guidelines