Skip to content

Commit

Permalink
chore(telemetry): add environment variable to optionally disable tele…
Browse files Browse the repository at this point in the history
…metry (#2810)

* Add DISABLE_TELEMETRY env variable & functionality

* WIP create test for DISABLE_TELEMETRY env variable

* Update DISABLE_TELEMETRY and remove wip test

* Clean code up
  • Loading branch information
zwhitfield3 authored Apr 16, 2024
1 parent 1541dfc commit 697df38
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/cli/src/global_telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const {version} = require('../package.json')

const root = path.resolve(__dirname, '../package.json')
const isDev = process.env.IS_DEV_ENVIRONMENT === 'true'
const isTelemetryDisabled = process.env.DISABLE_TELEMETRY === 'true'

function getToken() {
const config = new Config({root})
Expand Down Expand Up @@ -152,6 +153,10 @@ export function reportCmdNotFound(config: any) {

export async function sendTelemetry(currentTelemetry: any, rollbarCb?: () => void) {
// send telemetry to honeycomb and rollbar
if (isTelemetryDisabled) {
return
}

const telemetry = currentTelemetry

if (telemetry instanceof Error) {
Expand Down

0 comments on commit 697df38

Please sign in to comment.