Skip to content

feat(telemetry): send error reports again, to a new Sentry project - #180

Open
dg-dayhaysoos wants to merge 1 commit into
mainfrom
feat/telemetry-new-sentry-project
Open

dg-dayhaysoos wants to merge 1 commit into
mainfrom
feat/telemetry-new-sentry-project

Conversation

@dg-dayhaysoos

Copy link
Copy Markdown

Summary

dg has sent no telemetry since 0.4.1. This turns error reporting back on, sending to a new Sentry project (deepgram-cli).

A report is still one event per run, only for an unexpected error, built from the allowlist in docs/telemetry.md. Nothing is sent when a command succeeds or for a usage error.

What changes for users

  • On by default, announced first. The first run at a terminal prints a one-time notice on stderr and sends nothing. Reports start with the next run. The notice isn't printed under --quiet, for help, without a terminal, or in an AI agent session, and those runs don't count as shown. So an install that is only used from scripts, containers or agents never reports.
  • Every existing opt-out still applies: --no-telemetry, DEEPCTL_TELEMETRY_DISABLED, DEEPCTL_TELEMETRY=off, DO_NOT_TRACK, CI, and telemetry.enabled: false in the user config. Someone who has opted out never sees the notice.
  • Plugin command names are left out. A plugin command's path and flag names are no longer in a report, like a plugin's module and function names already weren't.

Safeguards

  • Fixed destination. The DSN is built in. DEEPCTL_TELEMETRY_DSN can only replace it with a loopback sink; any other value, an empty one included, turns reporting off. A test checks the DSN's shape and that it is the only Sentry address in shipped source.
  • Source checkouts don't report. dg reads its own install metadata. It counts as a release only if the metadata was written by an installer, describes the code that is running, and isn't an editable install. uv sync, pip install -e . and a checkout on PYTHONPATH all send nothing.
  • The notice is recorded per user. "Shown" is an empty file in the account's real cache directory (telemetry/notice-shown), under the same ownership rules as the help cache. If it can't be read or written, nothing is sent.
  • Tests can't reach Sentry. The root conftest.py and the workflows already point DEEPCTL_TELEMETRY_DSN at a closed loopback port. Tests that remove it patch the SDK.

Not covered

A checkout that is built and installed non-editably (pip install ., uv tool install ., locally built wheels) reports as if it were the last release. #179 has the options.

Testing

  • uv run pytest: the new and changed tests pass. Two tests in tests/unit/test_stream_discipline.py fail on my machine, and fail the same way on main.
  • ruff format --check, ruff check and mypy pass on src/ packages/*/src scripts/.
  • The telemetry, wiring and base-command tests also pass against wheels built from this branch, apart from three test_config_opt_out_caps.py tests that fail the same way on main with PyYAML 6.0.4 and pass with the locked 6.0.3.
  • In a wheel-installed build, with the cache redirected and the Sentry SDK replaced by recorders: the first run at a terminal printed the notice and made no SDK call; the second printed nothing and reported to the built-in DSN. No real report was sent to the new project.

🤖 Generated with Claude Code

dg has sent no telemetry since 0.4.1. This turns error reporting back on:
one report per run, only for an unexpected error, built from the published
field allowlist, sent to the `deepgram-cli` Sentry project.

- The destination is built in. DEEPCTL_TELEMETRY_DSN can only replace it
  with a loopback sink; any other value, an empty one included, turns
  reporting off.
- A source checkout never reports. dg reads its own install metadata: the
  metadata must come from an installer, describe the code that is running,
  and not be an editable install.
- Nothing is sent before dg has said so. The first run at a terminal prints
  a one-time notice on stderr and sends nothing; reports start with the next
  run. A local sink and DEEPCTL_TELEMETRY=log don't wait for it.
- A plugin command's path and flag names are left out of a report, like a
  plugin's module and function names already were.
- Every existing opt-out still applies: --no-telemetry,
  DEEPCTL_TELEMETRY_DISABLED, DEEPCTL_TELEMETRY=off, DO_NOT_TRACK, CI and
  telemetry.enabled: false in the user config.

Refs #179

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant