Improve and trace connection startup performance - #22616
Open
Chris Johnstone (cjohnsto-nz) wants to merge 2 commits into
Open
Improve and trace connection startup performance#22616Chris Johnstone (cjohnsto-nz) wants to merge 2 commits into
Chris Johnstone (cjohnsto-nz) wants to merge 2 commits into
Conversation
Copilot started reviewing on behalf of
Chris Johnstone (cjohnsto-nz)
August 5, 2026 04:49
View session
Contributor
There was a problem hiding this comment.
Pull request overview
This PR focuses on improving connection-startup performance and diagnosability by adding correlation-aware, phase-level tracing across the connection dialog, connection manager, Object Explorer session creation, and VS Code Entra token acquisition, plus making startup loading more concurrent.
Changes:
- Load saved connections and connection groups concurrently during connection-manager startup checks.
- Propagate correlation IDs and timestamps from the Connection Dialog through Object Explorer session creation and key connection phases.
- Add privacy-conscious timing traces for Entra token acquisition and Object Explorer/SQL Tools Service connection phases, with unit tests covering the new tracing/validation behavior.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| extensions/mssql/test/unit/vscodeEntraMfaUtils.test.ts | Adds unit coverage for separate silent vs interactive token-session trace phases. |
| extensions/mssql/test/unit/connectionManager.test.ts | Adds a test ensuring connection/group reads are initiated together during startup checks. |
| extensions/mssql/test/unit/connectionDialogWebviewController.test.ts | Adds tests for correlation logging, missing payload handling, payload sanitization, and correlation propagation to OE creation. |
| extensions/mssql/src/webviews/pages/ConnectionDialog/connectionDialogStateProvider.tsx | Emits a click correlation payload from the webview when “Connect” is pressed. |
| extensions/mssql/src/sharedInterfaces/connectionDialog.ts | Extends the connect reducer payload to optionally include clickId/clickTimestamp. |
| extensions/mssql/src/objectExplorer/objectExplorerService.ts | Records click traces and emits phase-level OE timing logs correlated to a click. |
| extensions/mssql/src/objectExplorer/objectExplorerProvider.ts | Plumbs correlation/timing parameters through provider APIs and exposes recordConnectionClick. |
| extensions/mssql/src/controllers/mainController.ts | Generates correlation IDs for OE selection and records them for expansion tracing; plumbs correlation through session creation. |
| extensions/mssql/src/controllers/connectionManager.ts | Adds connection-phase tracing, concurrent startup reads, and privacy-conscious Entra token timing logs. |
| extensions/mssql/src/connectionconfig/connectionDialogWebviewController.ts | Validates/normalizes correlation payloads and traces connection form/submit/test/connect phases. |
| extensions/mssql/src/azure/vscodeEntraMfaUtils.ts | Adds trace helpers to time and correlate account/tenant/session/token acquisition phases. |
Copilot started reviewing on behalf of
Chris Johnstone (cjohnsto-nz)
August 5, 2026 05:13
View session
5 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.
Suppressed comments (2)
extensions/mssql/test/unit/vscodeEntraMfaUtils.test.ts:74
- These expectations likely won’t match the actual trace output:
traceTokenPhase()prefixes messages with[ConnectionTrace] VS Code accounts ...and the "completed" messages also includedurationMs=...(and potentially additional details). Using regex matchers here avoids brittle exact-string matching.
expect(traceLogger.debug).to.have.been.calledWithMatch(
"silent token session request started requestId=token-request",
);
expect(traceLogger.debug).to.have.been.calledWithMatch(
"silent token session request completed requestId=token-request",
);
expect(traceLogger.debug).to.have.been.calledWithMatch(
"interactive token session request started requestId=token-request",
);
expect(traceLogger.debug).to.have.been.calledWithMatch(
"interactive token session request completed requestId=token-request",
);
extensions/mssql/test/unit/vscodeEntraMfaUtils.test.ts:8
- This test uses sinon-chai assertions (e.g.
expect(...).to.have.been.calledWithMatch(...)) but doesn’t register the sinon-chai plugin in this file. Test order isn’t guaranteed, so this can fail when the file is run in isolation.
This issue also appears on line 63 of the same file.
import { expect } from "chai";
import * as vscode from "vscode";
import {
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.
Description
This PR extracts the connection-startup and diagnostic improvements from #22614 into a focused change.
It improves startup performance and makes slow connection phases easier to diagnose by:
The traces contain timings, correlation identifiers, authentication type, and boolean state only. They do not include server names, database names, account IDs, tenant IDs, resource endpoints, or credentials.
Validation performed:
npm run build -- --target mssqlnpm run test -- --target mssql --coverage=falsenpm run package -- --target mssql --onlineCode Changes Checklist
npm run test)Reviewers: Please read our reviewer guidelines