diff --git a/README.md b/README.md index 757465e..70d7707 100644 --- a/README.md +++ b/README.md @@ -321,6 +321,38 @@ dg profiles --switch staging # Switch profile Output format on any command: `--output json|yaml|table|csv` +## Telemetry + +The CLI phones home anonymous error reports to help us catch crashes and regressions before users have to file an issue. It's **on by default** and easy to turn off. + +**What's collected:** Python exceptions, stack traces, the CLI version, and the Python runtime. Request bodies, headers, cookies, API keys, email addresses, IP addresses, and usernames are scrubbed before send. No performance traces, no profiling, no replays — errors only. + +**Where it goes:** the `dx-cli` Sentry project owned by the Deepgram DX team. + +### Opt out + +Persistent (recommended): + +```bash +dg config set telemetry.enabled false +``` + +One-shot (CI, scripts, single command): + +```bash +DEEPCTL_TELEMETRY_DISABLED=1 dg listen recording.wav +``` + +### Override the destination + +For forks or self-hosted Sentry, point telemetry at your own DSN: + +```bash +export DEEPCTL_TELEMETRY_DSN='https://@/' +``` + +`DEEPCTL_TELEMETRY_DISABLED` always wins. The default DSN is baked into the package and only used when the override is unset. + ## Development ```bash diff --git a/web/sentry.client.config.ts b/web/sentry.client.config.ts index 35adc4e..fd0bd73 100644 --- a/web/sentry.client.config.ts +++ b/web/sentry.client.config.ts @@ -1,17 +1,10 @@ import * as Sentry from '@sentry/astro'; -const STORAGE_KEY = 'dg_telemetry'; -const optedOut = - typeof window !== 'undefined' && - window.localStorage?.getItem(STORAGE_KEY) === 'off'; - -if (!optedOut) { - Sentry.init({ - dsn: 'https://d7a2aabbf772218e3bbe89266999af70@o206115.ingest.us.sentry.io/4510993603362816', - environment: import.meta.env.PROD ? 'production' : 'development', - sendDefaultPii: false, - tracesSampleRate: 0, - replaysSessionSampleRate: 0, - replaysOnErrorSampleRate: 0, - }); -} +Sentry.init({ + dsn: 'https://d7a2aabbf772218e3bbe89266999af70@o206115.ingest.us.sentry.io/4510993603362816', + environment: import.meta.env.PROD ? 'production' : 'development', + sendDefaultPii: false, + tracesSampleRate: 0, + replaysSessionSampleRate: 0, + replaysOnErrorSampleRate: 0, +}); diff --git a/web/src/pages/index.astro b/web/src/pages/index.astro index 554c3ca..ce2397a 100644 --- a/web/src/pages/index.astro +++ b/web/src/pages/index.astro @@ -862,10 +862,6 @@ const commandCards: CommandCard[] = [
© {new Date().getFullYear()} Deepgram, Inc. All rights reserved. - - Telemetry: on - -
@@ -1103,26 +1099,4 @@ const commandCards: CommandCard[] = [ (window as any).switchInstall = switchInstall; (window as any).copyInstall = copyInstall; (window as any).copyCmd = copyCmd; - - // ── Telemetry opt-out toggle ───────────────────────────────── - // Reads/writes the `dg_telemetry` localStorage flag. Sentry init - // in sentry.client.config.ts checks the same flag on page load. - (() => { - const STORAGE_KEY = 'dg_telemetry'; - const stateEl = document.getElementById('dg-tel-state'); - const toggleEl = document.getElementById('dg-tel-toggle'); - if (!stateEl || !toggleEl) return; - const render = () => { - const off = localStorage.getItem(STORAGE_KEY) === 'off'; - stateEl.textContent = off ? 'off' : 'on'; - }; - toggleEl.addEventListener('click', () => { - const off = localStorage.getItem(STORAGE_KEY) === 'off'; - if (off) localStorage.removeItem(STORAGE_KEY); - else localStorage.setItem(STORAGE_KEY, 'off'); - render(); - location.reload(); - }); - render(); - })();