diff --git a/apps/wing/src/analytics/disclaimer.ts b/apps/wing/src/analytics/disclaimer.ts index bf3659f665c..0e383e6944d 100644 --- a/apps/wing/src/analytics/disclaimer.ts +++ b/apps/wing/src/analytics/disclaimer.ts @@ -7,14 +7,16 @@ const disclaimer = ` We are working hard to make this a great tool, but there's still a pretty good chance you'll encounter missing pieces, rough edges, performance issues and even, god forbid, bugs 🐞. + Please don't hesitate to ping us at ${chalk.blueBright.bold.underline( "https://t.winglang.io/slack" )} or file an issue at ${chalk.blueBright.bold.underline( "https://github.com/winglang/wing" )}. We promise to do our best to respond quickly and help out. + To help us identify issues early, we are collecting anonymous analytics. -To turn this off, set ${chalk.yellowBright.bold("WING_CLI_DISABLE_ANALYTICS=1")}. +To turn this off, set ${chalk.yellowBright.bold("WING_DISABLE_ANALYTICS=1")}. For more information see ${chalk.blueBright.bold.underline("https://winglang.io/docs/analytics")} ${chalk.redBright("(This message will self-destruct after the first run)")} `; diff --git a/apps/wing/src/analytics/scripts/detached-export.ts b/apps/wing/src/analytics/scripts/detached-export.ts index 51b532c0777..ba7e5d1adc5 100644 --- a/apps/wing/src/analytics/scripts/detached-export.ts +++ b/apps/wing/src/analytics/scripts/detached-export.ts @@ -1,6 +1,7 @@ import { getAnonymousId, loadAnalyticsEvent } from '../storage'; import * as fs from 'fs'; import Analytics from '@segment/analytics-node'; +import { getWingAnalyticsCollectionConfig } from '../collect'; // When this file is run as a child process, it will be passed the path // to the analytics report file @@ -9,16 +10,19 @@ const filePath = process.argv[2]; try { const analytics = new Analytics({ writeKey: 'sCqPF5xSscOjJdi5Tbkqu73vfF8zkZdw'}); const event = loadAnalyticsEvent(filePath); + const analyticsConfig = getWingAnalyticsCollectionConfig(); - analytics.track({ - anonymousId: getAnonymousId(), - timestamp: event.timestamp, - event: event.event, - properties: event.properties, - }); + if (analyticsConfig.export) { + analytics.track({ + anonymousId: getAnonymousId(), + timestamp: event.timestamp, + event: event.event, + properties: event.properties, + }); + } // Keeps the file around for debugging purposes - if (!process.env.WING_ANALYTICS_DEBUG) { + if (!analyticsConfig.debug) { fs.unlinkSync(filePath); } } catch(err) {