Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion extensions/cli/spec/otlp-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The Continue CLI should emit metrics that provide insights into:

| Environment Variable | Description | Example Values |
| ------------------------------- | --------------------------------------------------------- | ------------------------------------ |
| `CONTINUE_CLI_ENABLE_TELEMETRY` | Enables telemetry collection (required) | `1` |
| `CONTINUE_CLI_ENABLE_TELEMETRY` | Enables OTEL telemetry collection (required) | `1` |
| `OTEL_METRICS_EXPORTER` | Metrics exporter type(s) (comma-separated) | `console`, `otlp`, `prometheus` |
| `OTEL_LOGS_EXPORTER` | Logs/events exporter type(s) (comma-separated) | `console`, `otlp` |
| `OTEL_EXPORTER_OTLP_PROTOCOL` | Protocol for OTLP exporter (all signals) | `grpc`, `http/json`, `http/protobuf` |
Expand Down
2 changes: 1 addition & 1 deletion extensions/cli/spec/telemtry.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

- Used by Continue for product metrics (not used by customers)
- uses public posthog key in repo
- CONTINUE_CLI_ENABLE_TELEMETRY can be set to false to disable
- CONTINUE_ALLOW_ANONYMOUS_TELEMETRY can be set to 0 to disable
- non-anonymous and private data like code is never sent to posthog
- Event user ids are the Continue user id is signed in, or a unique machine id if not
- Current events are slash command usage and chat calls
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ describe("PosthogService Error Handling", () => {

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

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

// Restore environment
if (originalEnv === undefined) {
delete process.env.CONTINUE_CLI_ENABLE_TELEMETRY;
delete process.env.CONTINUE_ALLOW_ANONYMOUS_TELEMETRY;
} else {
process.env.CONTINUE_CLI_ENABLE_TELEMETRY = originalEnv;
process.env.CONTINUE_ALLOW_ANONYMOUS_TELEMETRY = originalEnv;
}
});
});
6 changes: 3 additions & 3 deletions extensions/cli/src/telemetry/posthogService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe("PosthogService", () => {
vi.spyOn(os, "homedir").mockReturnValue(tempDir);

// Clear environment variable
delete process.env.CONTINUE_CLI_ENABLE_TELEMETRY;
delete process.env.CONTINUE_ALLOW_ANONYMOUS_TELEMETRY;

// Reset all mocks
vi.clearAllMocks();
Expand Down Expand Up @@ -116,8 +116,8 @@ describe("PosthogService", () => {
expect(service.isEnabled).toBe(true);
});

it("should be disabled when CONTINUE_CLI_ENABLE_TELEMETRY is 0", () => {
process.env.CONTINUE_CLI_ENABLE_TELEMETRY = "0";
it("should be disabled when CONTINUE_ALLOW_ANONYMOUS_TELEMETRY is 0", () => {
process.env.CONTINUE_ALLOW_ANONYMOUS_TELEMETRY = "0";
const service = new PosthogService();
expect(service.isEnabled).toBe(false);
});
Expand Down
2 changes: 1 addition & 1 deletion extensions/cli/src/telemetry/posthogService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class PosthogService {
}

get isEnabled() {
return process.env.CONTINUE_CLI_ENABLE_TELEMETRY !== "0";
return process.env.CONTINUE_ALLOW_ANONYMOUS_TELEMETRY !== "0";
Copy link
Collaborator

Choose a reason for hiding this comment

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

This isn't right, its changing the flag name for enabling posthog telemetry. We should be changing the flag name for wherever OTEL is enabled

}

private _client: PostHogType | undefined;
Expand Down
1 change: 1 addition & 0 deletions extensions/cli/vitest.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { resetConsoleOverrides } from "./src/init.js";

// Disable telemetry for tests
process.env.CONTINUE_CLI_ENABLE_TELEMETRY = "0";
process.env.CONTINUE_ALLOW_ANONYMOUS_TELEMETRY = "0";

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