Skip to content

refactor(ENG-15367): share telemetry opt-outs and the exit wait budget - #568

Draft
tigh-latte wants to merge 1 commit into
masterfrom
eng-14331-1-shared-helpers
Draft

tigh-latte wants to merge 1 commit into
masterfrom
eng-14331-1-shared-helpers

Conversation

@tigh-latte

@tigh-latte tigh-latte commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Usage telemetry stack, part 1 of 6. Start here. Each PR builds on the one before it.

Description

This stack adds pseudonymous usage telemetry to the CLI. Each run sends one cli command executed event to PostHog, so we can see which commands, flags and setups are actually used before we change or remove them. The code ships without a project key. A build only sends when a developer points it at a test project.

This first PR only moves shared code. The opt-out checks, build environment detection and the Cloudsmith host check move out of the Sentry module into core/telemetry_common.py, so error reporting and usage telemetry follow one set of rules.

Behaviour changes

  • The config check for telemetry = false now also reads the file named by CLOUDSMITH_CONFIG_FILE, like the rest of the CLI. Before, telemetry = false in that file did not turn Sentry off.
  • The update check's end-of-run wait (up to 1 s) now comes from a budget it shares with usage telemetry. Together they never delay a command's exit by more than 1 s. On its own, the update check waits as before.

Sentry and PostHog once the full stack is in

Sentry (exists today) PostHog usage (this stack)
Sends When an unexpected exception escapes Once per command run
Opt-outs DO_NOT_TRACK, CLOUDSMITH_NO_TELEMETRY, telemetry = false The same three (this PR)
Never sends for User errors, TLS certificate failures Credential helper calls, mcp start, telemetry, shell completion, non-Cloudsmith API hosts, SSL verification off, development builds without a test key
Content Exception type, scrubbed message and stack frames Names, enums, numbers and booleans only. No free text
Wait at exit Up to 2 s, only on a crash Shares 1 s with the update check
Transport Sentry SDK Plain POST, no retries, no redirects

The stack

# PR What it adds
1 #568 Shared opt-outs and exit wait budget
2 #569 Usage event, install ID, first-run notice
3 #570 Sender and the rules for when a run sends nothing
4 #571 Capture from the Click context, send at the end of every run
5 #572 cloudsmith telemetry status / id / reset
6 #573 AI agent label

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring
  • Other (please describe)

Additional Notes

N/A: nothing calls the moved helpers in a new way until #569 onwards.

🤖 Generated with Claude Code

Move the opt-out checks, build environment detection and the Cloudsmith
host check out of the Sentry module into core/telemetry_common.py, so
error reporting and usage telemetry follow the same rules.

The update check now draws its end-of-run wait from a shared 1 second
budget, so all background work together never delays a command's exit by
more than 1 second.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tigh-latte tigh-latte changed the title refactor(ENG-14331): share telemetry opt-outs and the exit wait budget refactor(ENG-15367): share telemetry opt-outs and the exit wait budget Oct 29, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants