Skip to content

Conversation

rossigee
Copy link
Contributor

@rossigee rossigee commented Oct 18, 2025

Improve telemetry handling in Continue CLI

Description

When running the CLI in a network that can't reach the telemetry endpoints, it produces lots of DNS/network related stacktraces during operation.

This PR enhances the telemetry system in the Continue CLI by addressing issues with blocked telemetry and providing unified control over telemetry settings.

Changes Made

1. Handle Blocked Telemetry Detection

  • Added DNS resolution checking for app.posthog.com to detect when telemetry is blocked by network configurations
  • Considers telemetry blocked when DNS resolves to invalid addresses (e.g., 0.0.0.0, 127.x.x.x)
  • Displays a warning message when telemetry appears blocked, with instructions to disable using CONTINUE_TELEMETRY_ENABLED=0
  • Added comprehensive tests for DNS resolution scenarios

2. Unified Telemetry Control

  • Introduced CONTINUE_TELEMETRY_ENABLED environment variable to control both PostHog and OpenTelemetry telemetry
  • Maintains backward compatibility with existing variables:
    • CONTINUE_ALLOW_ANONYMOUS_TELEMETRY (PostHog)
    • CONTINUE_CLI_ENABLE_TELEMETRY (OpenTelemetry)
  • Updated warning messages to reference the new unified variable

Motivation

  • Blocked Telemetry: Users in corporate environments or with restrictive networks may have telemetry blocked, leading to confusion about why telemetry isn't working. This change provides clear feedback and control.
  • Unified Control: Having separate variables for different telemetry types was confusing. A single variable simplifies user experience.

Testing

  • Added unit tests for DNS resolution detection, including edge cases like invalid addresses
  • Verified backward compatibility with existing environment variables
  • Tested telemetry enable/disable logic

Breaking Changes

None - all changes are backward compatible.


Summary by cubic

Improve telemetry handling in the Continue CLI to avoid noisy DNS/network errors when telemetry is blocked, and add a single env var to control all telemetry.

  • New Features
    • Detect blocked PostHog via DNS for app.posthog.com; treat 0.0.0.0 and 127.x.x.x as blocked, skip telemetry, and show a single warning with CONTINUE_TELEMETRY_ENABLED=0 guidance.
    • Add CONTINUE_TELEMETRY_ENABLED to control both PostHog and OpenTelemetry; keep CONTINUE_ALLOW_ANONYMOUS_TELEMETRY and CONTINUE_CLI_ENABLE_TELEMETRY for backward compatibility.
    • Add unit tests for DNS resolution outcomes and reduce noisy logs when offline or blocked.

rossigee and others added 2 commits October 18, 2025 10:08
- Add CONTINUE_TELEMETRY_ENABLED env var to control both PostHog and OpenTelemetry telemetry
- Maintain backward compatibility with existing CONTINUE_ALLOW_ANONYMOUS_TELEMETRY and CONTINUE_CLI_ENABLE_TELEMETRY variables
- Update warning message to reference the new unified variable

Generated with [Continue](https://continue.dev)

Co-Authored-By: Continue <[email protected]>
@rossigee rossigee requested a review from a team as a code owner October 18, 2025 05:35
@rossigee rossigee requested review from sestinj and removed request for a team October 18, 2025 05:35
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Oct 18, 2025
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 3 files

Prompt for AI agents (all 1 issues)

Understand the root cause of the following 1 issues and fix them.


<file name="extensions/cli/src/telemetry/telemetryService.ts">

<violation number="1" location="extensions/cli/src/telemetry/telemetryService.ts:83">
CONTINUE_TELEMETRY_ENABLED=&quot;false&quot; still enables telemetry because the code falls back to the legacy flag instead of honoring the new value.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

telemetryEnabled = true;
} else {
// Fall back to legacy variable for backward compatibility
telemetryEnabled = process.env.CONTINUE_CLI_ENABLE_TELEMETRY !== "0";
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Oct 18, 2025

Choose a reason for hiding this comment

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

CONTINUE_TELEMETRY_ENABLED="false" still enables telemetry because the code falls back to the legacy flag instead of honoring the new value.

Prompt for AI agents
Address the following comment on extensions/cli/src/telemetry/telemetryService.ts at line 83:

<comment>CONTINUE_TELEMETRY_ENABLED=&quot;false&quot; still enables telemetry because the code falls back to the legacy flag instead of honoring the new value.</comment>

<file context>
@@ -71,8 +71,19 @@ class TelemetryService {
+      telemetryEnabled = true;
+    } else {
+      // Fall back to legacy variable for backward compatibility
+      telemetryEnabled = process.env.CONTINUE_CLI_ENABLE_TELEMETRY !== &quot;0&quot;;
+    }
+
</file context>
Fix with Cubic

Copy link
Collaborator

@RomneyDa RomneyDa left a comment

Choose a reason for hiding this comment

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

// Fall back to the legacy variable for backward compatibility

@rossigee we recently split CONTINUE_ALLOW_ANONYMOUS_TELEMETRY and CONTINUE_CLI_ENABLE_TELEMETRY intentionally, because they needed to be independently configurable

#8126

CONTINUE_CLI_ENABLE_TELEMETRY is for OTEL, CONTINUE_ALLOW_ANONYMOUS_TELEMETRY is for posthog. Could you clarify reasons to merge? I think the no internet updates would be great

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Issues and PRs Oct 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants