Repository navigation
Add telemetry correlation headers to dev tunnel service requests - #340787
Merged
Merged
Conversation
Use tunnel services' injected telemetry sessions, record operation correlation, and generate fresh request IDs for management requests and relay handshakes. Pass host correlation into the CLI and preserve non-UUID session IDs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Connor Peet (connor4312)
enabled auto-merge (squash)
October 9, 2026 19:11
Use tunnelSessionId for explicit tunnel correlation without shadowing the reserved common sessionID property. Preserve request header values and operation IDs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Send session and operation IDs only in tunnel service headers, removing the debug log flagged by CodeQL. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Dmitriy Vasyura (dmitrivMS)
previously approved these changes
Oct 9, 2026
Contributor
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
3 open findings
_runTransient()always logs atunnelServiceOperationwith operation'host'and always injects… · Newfallback.to_string()+HeaderValue::from_str(...).unwrap()is repeated in multiple match arms.… · New The telemetry event/classification types are declared insidecreateTunnelServiceCorrelation(),… · New
What changed in this PR
Adds telemetry correlation for Dev Tunnels management requests and (where supported) relay handshakes, enabling VS Code telemetry session/operation/request IDs to flow through web, desktop, and CLI tunnel interactions.
Changes:
- Introduces shared tunnel correlation/helpers (
createTunnelServiceCorrelation,tunnelServiceHeaders) and wires them into browser, agent host, remote tunnel, and CLI flows. - Extends the tunnel coordinator + telemetry events to carry correlation (session/operation IDs) into CLI invocations and
remoteTunnel.connected. - Updates Dev Tunnels SDK dependencies (TS to
1.3.61, Rusttunnelsgit rev) and adds focused unit tests.
| File | Description |
|---|---|
| src/vs/sessions/contrib/providers/remoteAgentHost/test/browser/browserTunnelAgentHostService.test.ts | Updates browser tests to validate management client receives additional request headers. |
| src/vs/sessions/contrib/providers/remoteAgentHost/browser/webTunnelAgentHostService.contribution.ts | Injects ITelemetryService into browser tunnel agent host service selection. |
| src/vs/sessions/contrib/providers/remoteAgentHost/browser/devTunnelsWebLoader.ts | Extends web management client interface to accept additional request headers. |
| src/vs/sessions/contrib/providers/remoteAgentHost/browser/browserTunnelAgentHostService.ts | Attaches correlation headers to browser management requests and relay creation path. |
| src/vs/platform/remoteTunnel/test/node/tunnelProcessCoordinator.test.ts | Adds test coverage ensuring correlation env vars are passed to all CLI invocations. |
| src/vs/platform/remoteTunnel/test/node/remoteTunnelService.test.ts | Updates tests to validate correlation is plumbed into remoteTunnel.connected telemetry. |
| src/vs/platform/remoteTunnel/test/common/tunnelServiceHeaders.test.ts | New unit tests for header correlation + per-request request-id refresh behavior. |
| src/vs/platform/remoteTunnel/node/tunnelProcessCoordinator.ts | Passes correlation into CLI env and machine-status events; suppresses correlation on attach. |
| src/vs/platform/remoteTunnel/node/remoteTunnelService.ts | Logs correlation into remoteTunnel.connected when available; updates telemetry classifications. |
| src/vs/platform/remoteTunnel/common/tunnelServiceHeaders.ts | New shared helper for creating correlation IDs and generating headers (fresh request ID per copy). |
| src/vs/platform/agentHost/test/node/tunnelAgentHostService.test.ts | Adds correlation-focused tests and updates construction to inject telemetry service. |
| src/vs/platform/agentHost/node/tunnelAgentHostService.ts | Adds correlation header injection to management client creation for list/connect/delete. |
| package.json | Bumps Dev Tunnels TypeScript SDK packages to ^1.3.61. |
| cli/src/tunnels/dev_tunnels.rs | Adds correlation header injection based on env vars (with validation) + Rust tests. |
| cli/Cargo.toml | Pins Rust tunnels dependency to a newer git revision supporting custom headers. |
| cli/CONTRIBUTING.md | Documents tunnel request correlation behavior and env vars for CLI. |
🧠 Review effort: Lite
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Keep correlation IDs for every CLI invocation but emit host-operation telemetry only for actual host launches. Reuse a single Rust fallback header and share the narrow operation type across telemetry declarations. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
roblourens
approved these changes
Oct 9, 2026
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.


Summary
Correlate Dev Tunnels management requests and relay handshakes with VS Code telemetry using the SDK support from microsoft/dev-tunnels#685.
Companion Remote Tunnels extension/SDK changes: microsoft/vscode-remote-tunnels#807.
ITelemetryServicein the browser/shared-process clients and CLI process coordinator.X-Tunnels-VSCode-Session-Id,X-Tunnels-VSCode-Client-Operation-Id, and a freshX-Tunnels-VSCode-Client-Request-Idfor management requests and supported relay handshakes.tunnelServiceOperationand correlate CLI hosting with existingremoteTunnel.connectedtelemetry.tunnelSessionIdfor explicit telemetry correlation so the reserved commonsessionIDproperty is not shadowed.Browser WebSocket APIs cannot attach custom handshake headers; browser management requests still include them.
Validation
Rebased onto
mainbefore publishing.npm run build-fast -- --client-only— passed.npm run typecheck-client— passed after rebase.Focused unit tests — 93 passed after rebase:
cargo test --locked --manifest-path cli/Cargo.toml tunnels::dev_tunnels::test— 5 passed.Changed-TypeScript ESLint — passed before commit:
npm run valid-layers-check— passed during implementation.Scoped telemetry extraction including the actual telemetry common-property declarations — passed after fixing the CI metadata collision; verified
tunnelSessionIddoes not shadowsessionID, event classifications, and numeric/boolean measurement flags.CI-fix and review-feedback regression tests — 32 passed:
Repository pre-commit hygiene — passed.
Live Dev Tunnels service/backend ingestion and full integration/smoke suites were not run.