@@ -21,12 +21,14 @@ import { ext } from "../extensionVariables";
2121class ExtensionTelemetry {
2222 private readonly output ?: OutputChannel ;
2323 private readonly reporter ?: TelemetryReporter ;
24-
24+
2525 private readonly defaultProperties : { [ key : string ] : any } = { } ;
2626
2727 constructor ( ) {
28- const isEnableTelemetry =
29- workspace . getConfiguration ( "telemetry" ) . get ( "enableTelemetry" ) || true ;
28+ const isEnableTelemetry = ext . isRCExtension
29+ ? false
30+ : ( workspace . getConfiguration ( "telemetry" ) . get ( "enableTelemetry" ) ??
31+ true ) ;
3032 const isTestRun = process . env . CODE_TEST || false ;
3133
3234 if ( isEnableTelemetry ) {
@@ -37,7 +39,7 @@ class ExtensionTelemetry {
3739 this . reporter = new TelemetryReporter (
3840 ext . extensionName ,
3941 ext . extensionVersion ,
40- ext . extensionKey
42+ ext . extensionKey ,
4143 ) ;
4244 this . defaultProperties [ "common.vscodemachineid" ] =
4345 generateMachineId ( ) ;
@@ -53,23 +55,23 @@ class ExtensionTelemetry {
5355 public sendEvent (
5456 eventName : string ,
5557 properties ?: { [ key : string ] : string } ,
56- measurements ?: { [ key : string ] : number }
58+ measurements ?: { [ key : string ] : number } ,
5759 ) : void {
5860 const props = Object . assign ( { } , this . defaultProperties , properties ) ;
5961 if ( this . reporter ) {
6062 this . reporter . sendTelemetryEvent ( eventName , props , measurements ) ;
6163 }
6264 if ( this . output ) {
6365 this . output . appendLine (
64- `telemetry/${ eventName } ${ JSON . stringify ( { props, measurements } ) } `
66+ `telemetry/${ eventName } ${ JSON . stringify ( { props, measurements } ) } ` ,
6567 ) ;
6668 }
6769 }
6870
6971 public sendException (
7072 exception : Error ,
7173 properties ?: { [ key : string ] : string } ,
72- measurements ?: { [ key : string ] : number }
74+ measurements ?: { [ key : string ] : number } ,
7375 ) : void {
7476 const props = Object . assign ( { } , this . defaultProperties , properties ) ;
7577 const error = new Error ( exception . message ) ;
@@ -81,7 +83,7 @@ class ExtensionTelemetry {
8183
8284 if ( this . output ) {
8385 this . output . appendLine (
84- `telemetry/${ error } ${ JSON . stringify ( { props, measurements } ) } `
86+ `telemetry/${ error } ${ JSON . stringify ( { props, measurements } ) } ` ,
8587 ) ;
8688 }
8789 }
0 commit comments