Repository navigation
feat(ENG-15367): let commands choose what telemetry they send - #584
Open
tigh-latte wants to merge 1 commit into
Open
tigh-latte wants to merge 1 commit into
tigh-latte wants to merge 1 commit into
Conversation
tigh-latte
force-pushed
the
eng-14331-6-agent
branch
from
November 3, 2026 13:58
df786b2 to
c83d7b4
Compare
tigh-latte
force-pushed
the
eng-15367-7-send-policy
branch
from
November 3, 2026 13:58
73b7d57 to
9720604
Compare
tigh-latte
force-pushed
the
eng-14331-6-agent
branch
from
November 3, 2026 14:59
c83d7b4 to
34f2c8e
Compare
tigh-latte
force-pushed
the
eng-15367-7-send-policy
branch
from
November 3, 2026 14:59
9720604 to
0b1d429
Compare
tigh-latte
marked this pull request as ready for review
November 4, 2026 10:15
tigh-latte
force-pushed
the
eng-15367-7-send-policy
branch
from
November 4, 2026 11:13
0b1d429 to
9a7b50f
Compare
tigh-latte
force-pushed
the
eng-14331-6-agent
branch
2 times, most recently
from
November 5, 2026 10:28
489fd14 to
e96204d
Compare
tigh-latte
force-pushed
the
eng-15367-7-send-policy
branch
from
November 5, 2026 10:28
9a7b50f to
3986f10
Compare
1 of 6 tasks
cloudsmith-iduffy
left a comment
Collaborator
There was a problem hiding this comment.
Are we duplicating efforts across sentry and posthog if both are taking in errors? Should we be keeping posthog focused on getting data to understand how the cli is being used? or does it taking in errors have value? or should we get rid of sentry and use posthog for everything?
A command declares what it may send with @telemetry.send(...) from cloudsmith_cli/cli/telemetry.py: NONE, ERRORS (Sentry reports only), USAGE (usage events only) or ALL, the default. A policy on a group applies to every command under it unless a command sets its own, and it only narrows what is sent: the opt-outs always win. This replaces the list of excluded command names in core/usage/run.py. Credential helpers, mcp start and the telemetry group use ERRORS, so they still report crashes and send no usage events, as before. A test lists every command that sends less than ALL, so a change of policy is always visible in review. CLOUDSMITH_TELEMETRY=log now covers error reports too: the scrubbed Sentry event is printed to stderr instead of being sent, even without a DSN. Before, log mode only showed usage events and error reports were still sent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tigh-latte
force-pushed
the
eng-14331-6-agent
branch
from
November 5, 2026 11:37
e96204d to
e9fdf8d
Compare
tigh-latte
force-pushed
the
eng-15367-7-send-policy
branch
from
November 5, 2026 11:37
3986f10 to
5ea20dc
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR lets each command say what telemetry it may send, in one place, with a decorator:
ALL(default)ERRORSUSAGENONEDO_NOT_TRACK,CLOUDSMITH_NO_TELEMETRYandtelemetry = falsealways win, and every other rule (non-Cloudsmith hosts, SSL off, shell completion, user errors) still applies.test_every_command_that_sends_less_than_all_is_listed_herewalks the whole CLI and lists every command that sends less thanALL, so a policy change always shows up in the diff.This replaces the list of excluded command names in
core/usage/run.py, which lived far from the commands and silently stopped matching when a command was renamed. The policy is read from the Click context: bycollect_factsfor usage events, and byAliasGroup.mainbefore it reports an unexpected exception.Policies set in this PR (the same behaviour as before):
credential-helper docker / cargo / generic / pnpm / terraformERRORSmcp startERRORStelemetrygroupERRORSBehaviour changes
CLOUDSMITH_TELEMETRY=lognow covers error reports too: the scrubbed Sentry event is printed to stderr instead of being sent, even without a DSN. Before, log mode showed usage events only, and an error report was still sent, although the first-run notice says log mode shows exactly what is sent. The opt-outs still win in log mode.CLOUDSMITH_TELEMETRYandlog_mode()move tocore/telemetry_common.py, shared by Sentry and usage telemetry;core/usage/settings.pyre-exports them.Type of Change
Additional Notes
cloudsmith_cli/cli/telemetry.pyonly imports the stdlib-onlycore/telemetry_common.py, so importing it from command modules adds nothing to startup (test_startup_imports.pystill passes). Thetelemetrycommand module importssendandERRORSdirectly, because it defines thetelemetrygroup itself.