Skip to content

fix: add diagnostic telemetry and user-visible warning for URI handler failures (fixes #655)#723

Merged
tnaum-ms merged 5 commits into
microsoft:mainfrom
hanhan761:fix-655-uri-handler-diagnostics
Jun 22, 2026
Merged

fix: add diagnostic telemetry and user-visible warning for URI handler failures (fixes #655)#723
tnaum-ms merged 5 commits into
microsoft:mainfrom
hanhan761:fix-655-uri-handler-diagnostics

Conversation

@hanhan761

Copy link
Copy Markdown
Contributor

Summary

The globalUriHandler telemetry showed a 100% error rate. The most likely root cause is URIs being opened without a connectionString query parameter, causing extractAndValidateParams to throw an opaque error with no user-visible feedback.

Changes

  • Added diagnostic telemetry to the handler entry point: uriScheme, uriAuthority, uriPathLength, uriQueryLength, uriHasQuery — all non-sensitive, to help identify the actual failure pattern
  • Added queryFragmentNonEmpty telemetry in extractAndValidateParams and failureStage in the catch block to pinpoint which step fails
  • When connectionString is missing, surfaces a user-visible warning message instead of failing silently with only telemetry:

    "A DocumentDB deep-link was opened without a connection string. Ensure the link includes a connectionString query parameter."

Issue

Fixes #655

Verification

  • Single-file change (src/vscodeUriHandler.ts, +18 lines)
  • No logic changes to the success path — only telemetry additions and a warning message
  • Null-safe: uri.query ?? '' guards against undefined query

Copilot AI review requested due to automatic review settings June 2, 2026 14:21
@hanhan761 hanhan761 requested a review from a team as a code owner June 2, 2026 14:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds additional telemetry diagnostics and a targeted user-facing warning to improve troubleshooting of VS Code deep-link/URI handling failures.

Changes:

  • Record non-sensitive URI metadata (scheme/authority/path/query lengths) into telemetry for debugging.
  • Add a failureStage telemetry property in the top-level URI handler error path.
  • Show a warning message when a deep-link is missing the required connectionString query parameter.

Comment thread src/vscodeUriHandler.ts
Comment thread src/vscodeUriHandler.ts
Comment thread src/vscodeUriHandler.ts Outdated
@tnaum-ms tnaum-ms added the in-triage-queue We've seen your input and will triage it label Jun 4, 2026
hanhan761 and others added 3 commits June 19, 2026 12:20
- Remove showWarningMessage to avoid double notification (wrapper already shows errors)
- Set granular failureStage markers at extractParams/handleRequest boundaries
- Remove redundant uriHasQuery and queryFragmentNonEmpty (uriQueryLength covers it)
@tnaum-ms tnaum-ms force-pushed the fix-655-uri-handler-diagnostics branch from a9ef122 to 3209d7a Compare June 19, 2026 12:24
@tnaum-ms tnaum-ms removed the in-triage-queue We've seen your input and will triage it label Jun 19, 2026
@tnaum-ms tnaum-ms added this to the 0.9.1 milestone Jun 19, 2026
@tnaum-ms

Copy link
Copy Markdown
Collaborator

Maintainer note (review-driven changes)

On top of the original diagnostics, this branch adds a few review-driven, non-sensitive telemetry properties: errorName capture in the top-level catch (error type only, never the message), parameter counting (known vs unknown query keys) via URLSearchParams, and a connectionStringScheme classifier (mongodb / mongodb+srv / other). No secrets or connection details are logged.

A stray emdash was also removed from a code comment.

Note for reviewers: vscodeUriHandler.ts has heavy vscode/storage dependencies and no unit test; these telemetry-only changes were validated through the full build and test suite.

@tnaum-ms tnaum-ms enabled auto-merge June 22, 2026 11:45
@tnaum-ms tnaum-ms disabled auto-merge June 22, 2026 20:55
@tnaum-ms tnaum-ms merged commit 7cdf3e2 into microsoft:main Jun 22, 2026
5 checks passed
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.

Investigate URL handler - error rate at 100%

4 participants