Respect metered connections in Agent Host, CLI, and browser telemetry
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
## Context
#331897 consolidates the desktop core/debugger telemetry fixes from #331685 for #297362. The additional collectors below were explicitly deferred from that consolidation and need separate metered-connection support.
## Remaining paths
When telemetry is otherwise enabled, these paths do not currently receive metered-connection state:
- Agent Host telemetry: [agentHostTelemetryService.ts](https://github.com/microsoft/vscode/blob/2f9e41f65e66f04ca751ffe528ca7041f09b1438/src/vs/platform/agentHost/node/agentHostTelemetryService.ts) constructs its own 1DS collector, and [agentHostMicrosoftTelemetry.ts](https://github.com/microsoft/vscode/blob/2f9e41f65e66f04ca751ffe528ca7041f09b1438/src/vs/platform/agentHost/node/agentHostMicrosoftTelemetry.ts) creates separate internal collectors.
- CLI telemetry: [cliProcessMain.ts](https://github.com/microsoft/vscode/blob/2f9e41f65e66f04ca751ffe528ca7041f09b1438/src/vs/code/node/cliProcessMain.ts) constructs a collector and telemetry service without a metered service.
- Browser-local telemetry: [the web appender](https://github.com/microsoft/vscode/blob/2f9e41f65e66f04ca751ffe528ca7041f09b1438/src/vs/platform/telemetry/browser/1dsAppender.ts) makes an unconditional endpoint-health request. [The browser telemetry service](https://github.com/microsoft/vscode/blob/2f9e41f65e66f04ca751ffe528ca7041f09b1438/src/vs/workbench/services/telemetry/browser/telemetryService.ts) already filters events, but does not pause its physical collector or health probe.
## Expected follow-up
- Respect `network.meteredConnection` for these collectors, including initial-state readiness where applicable.
- Suppress health probes, scheduled/retry sends, and shutdown sends while metered, and resume correctly when unmetered.
- Preserve existing telemetry consent, telemetry-level restrictions, and enterprise policy behavior.
- Add deterministic transport-level tests; do not send real telemetry during validation.
This is a follow-up for these specific VS Code-owned collectors, not a request to add completion-provider behavior or broadly change extension/provider-owned telemetry.
Contributor guide
Research direction
Start with agentHostTelemetryService.ts, agentHostMicrosoftTelemetry.ts, cliProcessMain.ts, 1dsAppender.ts, and the browser telemetryService.ts to trace collector and health-probe setup. Add deterministic transport-level tests covering initial readiness, metered transitions, retries, scheduled sends, shutdown, and resumption while preserving consent, telemetry levels, and policy behavior. Done means no real telemetry is sent while metered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli, networking, observability, testing-qa
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 64/100