Skip to content

Commit b8677b2

Browse files
authored
Merge pull request #8126 from continuedev/continue/con-4291
Decouple anonymous telemetry from CONTINUE_CLI_ENABLE_TELEMETRY environment variable
2 parents 278a209 + 73057d3 commit b8677b2

File tree

6 files changed

+11
-10
lines changed

6 files changed

+11
-10
lines changed

extensions/cli/spec/otlp-metrics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ The Continue CLI should emit metrics that provide insights into:
1919

2020
| Environment Variable | Description | Example Values |
2121
| ------------------------------- | --------------------------------------------------------- | ------------------------------------ |
22-
| `CONTINUE_CLI_ENABLE_TELEMETRY` | Enables telemetry collection (required) | `1` |
22+
| `CONTINUE_CLI_ENABLE_TELEMETRY` | Enables OTEL telemetry collection (required) | `1` |
2323
| `OTEL_METRICS_EXPORTER` | Metrics exporter type(s) (comma-separated) | `console`, `otlp`, `prometheus` |
2424
| `OTEL_LOGS_EXPORTER` | Logs/events exporter type(s) (comma-separated) | `console`, `otlp` |
2525
| `OTEL_EXPORTER_OTLP_PROTOCOL` | Protocol for OTLP exporter (all signals) | `grpc`, `http/json`, `http/protobuf` |

extensions/cli/spec/telemtry.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
- Used by Continue for product metrics (not used by customers)
66
- uses public posthog key in repo
7-
- CONTINUE_CLI_ENABLE_TELEMETRY can be set to false to disable
7+
- CONTINUE_ALLOW_ANONYMOUS_TELEMETRY can be set to 0 to disable
88
- non-anonymous and private data like code is never sent to posthog
99
- Event user ids are the Continue user id is signed in, or a unique machine id if not
1010
- Current events are slash command usage and chat calls

extensions/cli/src/telemetry/posthogService.errorHandling.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ describe("PosthogService Error Handling", () => {
7979

8080
it("should not capture when service is disabled", async () => {
8181
// Mock environment variable to disable telemetry
82-
const originalEnv = process.env.CONTINUE_CLI_ENABLE_TELEMETRY;
83-
process.env.CONTINUE_CLI_ENABLE_TELEMETRY = "0";
82+
const originalEnv = process.env.CONTINUE_ALLOW_ANONYMOUS_TELEMETRY;
83+
process.env.CONTINUE_ALLOW_ANONYMOUS_TELEMETRY = "0";
8484

8585
// Create a new service instance to pick up the env var
8686
const disabledService = new PosthogService();
@@ -95,9 +95,9 @@ describe("PosthogService Error Handling", () => {
9595

9696
// Restore environment
9797
if (originalEnv === undefined) {
98-
delete process.env.CONTINUE_CLI_ENABLE_TELEMETRY;
98+
delete process.env.CONTINUE_ALLOW_ANONYMOUS_TELEMETRY;
9999
} else {
100-
process.env.CONTINUE_CLI_ENABLE_TELEMETRY = originalEnv;
100+
process.env.CONTINUE_ALLOW_ANONYMOUS_TELEMETRY = originalEnv;
101101
}
102102
});
103103
});

extensions/cli/src/telemetry/posthogService.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ describe("PosthogService", () => {
4242
vi.spyOn(os, "homedir").mockReturnValue(tempDir);
4343

4444
// Clear environment variable
45-
delete process.env.CONTINUE_CLI_ENABLE_TELEMETRY;
45+
delete process.env.CONTINUE_ALLOW_ANONYMOUS_TELEMETRY;
4646

4747
// Reset all mocks
4848
vi.clearAllMocks();
@@ -116,8 +116,8 @@ describe("PosthogService", () => {
116116
expect(service.isEnabled).toBe(true);
117117
});
118118

119-
it("should be disabled when CONTINUE_CLI_ENABLE_TELEMETRY is 0", () => {
120-
process.env.CONTINUE_CLI_ENABLE_TELEMETRY = "0";
119+
it("should be disabled when CONTINUE_ALLOW_ANONYMOUS_TELEMETRY is 0", () => {
120+
process.env.CONTINUE_ALLOW_ANONYMOUS_TELEMETRY = "0";
121121
const service = new PosthogService();
122122
expect(service.isEnabled).toBe(false);
123123
});

extensions/cli/src/telemetry/posthogService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class PosthogService {
4040
}
4141

4242
get isEnabled() {
43-
return process.env.CONTINUE_CLI_ENABLE_TELEMETRY !== "0";
43+
return process.env.CONTINUE_ALLOW_ANONYMOUS_TELEMETRY !== "0";
4444
}
4545

4646
private _client: PostHogType | undefined;

extensions/cli/vitest.setup.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { resetConsoleOverrides } from "./src/init.js";
44

55
// Disable telemetry for tests
66
process.env.CONTINUE_CLI_ENABLE_TELEMETRY = "0";
7+
process.env.CONTINUE_ALLOW_ANONYMOUS_TELEMETRY = "0";
78

89
// Mock the 'open' package to prevent browser opening during tests
910
vi.mock("open", () => ({

0 commit comments

Comments
 (0)