@@ -17,7 +17,13 @@ let telemetryReporter: TelemetryReporter;
1717export function activate ( context : vscode . ExtensionContext ) {
1818
1919 const packageInfo = getPackageInfo ( context ) ;
20- telemetryReporter = packageInfo && new TelemetryReporter ( packageInfo . name , packageInfo . version , packageInfo . aiKey ) ;
20+ if ( packageInfo && vscode . env . sessionId !== 'someValue.machineId' ) {
21+ // Use the real telemetry reporter
22+ telemetryReporter = new TelemetryReporter ( packageInfo . name , packageInfo . version , packageInfo . aiKey ) ;
23+ } else {
24+ // Fallback to a fake telemetry reporter
25+ telemetryReporter = new DebugTelemetryReporter ( '' , '' , '' ) ;
26+ }
2127 context . subscriptions . push ( telemetryReporter ) ;
2228
2329 context . subscriptions . push ( vscode . commands . registerCommand ( 'devtools-for-chrome.launch' , async ( ) => {
@@ -346,4 +352,18 @@ class DevToolsPanel {
346352 </html>
347353 ` ;
348354 }
355+ }
356+
357+ class DebugTelemetryReporter extends TelemetryReporter {
358+ constructor ( extensionId : string , extensionVersion : string , key : string ) {
359+ super ( extensionId , extensionVersion , key ) ;
360+ }
361+
362+ public sendTelemetryEvent ( name : string , properties ?: any , measurements ?: any ) {
363+ console . log ( `${ name } : ${ JSON . stringify ( properties ) } , ${ JSON . stringify ( properties ) } ` ) ;
364+ }
365+
366+ public dispose ( ) : Promise < any > {
367+ return Promise . resolve ( ) ;
368+ }
349369}
0 commit comments