# How --disable-telemetry Controls VS Code Data Collection in code-server

> Learn how the --disable-telemetry flag stops code-server data collection. Prevent outbound HTTP requests and halt all anonymous usage data gathering for enhanced privacy.

- Repository: [Coder/code-server](https://github.com/coder/code-server)
- Tags: deep-dive
- Published: 2026-03-01

---

**The `--disable-telemetry` flag prevents code-server from initializing its telemetry pipeline, ensuring zero outbound HTTP requests to telemetry endpoints and completely halting the collection of anonymous usage data.**

The code-server project maintains a telemetry system that collects anonymous usage metrics and transmits them to remote endpoints like `https://v1.telemetry.coder.com/track`. Understanding how the `--disable-telemetry` flag affects VS Code data collection is essential for privacy-conscious deployments and compliance-focused environments. This guide examines the exact implementation details from the `coder/code-server` repository to explain precisely what changes when you disable telemetry.

## How the Telemetry Pipeline Works

### CLI Flag Definition and Parsing

In [`src/node/cli.ts`](https://github.com/coder/code-server/blob/main/src/node/cli.ts), the flag is declared as a Boolean option within the CLI schema:

```ts
"disable-telemetry": { type: "boolean", description: "Disable telemetry." },

```

When the flag is present on startup, the parser sets `args["disable-telemetry"] = true` and stores this value in the `UserProvidedArgs` object that drives server initialization.

### Server-Side Conditional Initialization

The actual telemetry client creation is gated in the patched [`serverServices.ts`](https://github.com/coder/code-server/blob/main/serverServices.ts) (added by `patches/telemetry.diff`). The system only initializes telemetry if both the product reports telemetry support and the user has not disabled it:

```ts
if (supportsTelemetry(productService, environmentService) && !args["disable-telemetry"]) {
    // create TelemetryClient and attach it to the OneDataSystemAppender
}

```

If `--disable-telemetry` is set, the `TelemetryClient` class (which extends `AppInsightsCore`) is never instantiated. This prevents any POST requests to the telemetry endpoint, regardless of whether you use the default URL or a custom one.

## Practical Implications of Disabling Telemetry

When you pass `--disable-telemetry` to code-server, the following specific changes occur:

- **Zero outbound telemetry traffic**: The server never contacts the telemetry service because the `TelemetryClient` is never created in `patches/telemetry.diff`.
- **Environment variable override ignored**: Even if `CS_TELEMETRY_URL` is set to a custom endpoint, no data is transmitted when the flag is active.
- **Configuration file compatibility**: The `disable-telemetry` boolean can also be set in [`code-server.yaml`](https://github.com/coder/code-server/blob/main/code-server.yaml); CLI flags take precedence if both are specified.
- **Feature toggle awareness**: Features querying `productService.enableTelemetry` will see telemetry as disabled and may suppress usage-based UI hints, though core editor functionality remains unchanged.
- **Privacy compliance**: Users gain full control over whether any usage information leaves their machine, satisfying strict compliance requirements.
- **Analytics loss for maintainers**: The Coder team receives no usage statistics from that instance, potentially slowing identification of common pain points or usage patterns.

## Configuration Examples

### Command Line Usage

Disable telemetry when starting the server:

```bash
code-server --disable-telemetry

```

### Configuration File

Add the setting to your config file at `~/.config/code-server/config.yaml`:

```yaml
disable-telemetry: true

```

### Environment Variable Override (Disabled)

Demonstrating that custom endpoints are ignored when telemetry is disabled:

```bash
CS_TELEMETRY_URL="https://my-private-endpoint.example/track" code-server --disable-telemetry

```

Even with `CS_TELEMETRY_URL` set, **no HTTP requests** reach the custom URL because the conditional check `!args["disable-telemetry"]` prevents the `TelemetryClient` from ever being instantiated.

### Programmatic Detection

Check the flag status within the codebase:

```ts
import { parse } from "./cli";

const args = parse(process.argv.slice(2));
if (args["disable-telemetry"]) {
  console.log("Telemetry is disabled");
}

```

## Summary

- The `--disable-telemetry` flag in code-server completely disables the telemetry pipeline by preventing `TelemetryClient` initialization in `patches/telemetry.diff`.
- When disabled, no HTTP requests are sent to `https://v1.telemetry.coder.com/track` or any custom endpoint specified via `CS_TELEMETRY_URL`.
- The flag can be set via CLI argument or configuration file (`~/.config/code-server/config.yaml`), with CLI flags taking precedence.
- Core editor functionality remains unaffected; only usage analytics and related UI hints are suppressed.

## Frequently Asked Questions

### Does --disable-telemetry stop all VS Code data collection?

Yes. According to the code-server source code, when `--disable-telemetry` is set, the `TelemetryClient` class is never instantiated in `patches/telemetry.diff`. This prevents any POST requests to telemetry endpoints, ensuring no anonymous usage data leaves the machine.

### Can I disable telemetry via configuration file instead of CLI?

Yes. You can set `disable-telemetry: true` in your `~/.config/code-server/config.yaml` file. The value is loaded into the `UserProvidedArgs` object, which the server checks alongside CLI arguments. CLI flags override configuration file settings if both are present.

### What happens if I set CS_TELEMETRY_URL and --disable-telemetry together?

The `CS_TELEMETRY_URL` environment variable is ignored entirely. Since the conditional check `!args["disable-telemetry"]` prevents the `TelemetryClient` from being created, no telemetry client exists to read the endpoint configuration or transmit data to your custom URL.

### Does disabling telemetry affect code-server functionality?

No. Core editor features remain fully functional. The only effects are the suppression of usage-based UI hints that query `productService.enableTelemetry` and the absence of analytics data sent to the Coder team. The server operates normally without the telemetry pipeline.