@@ -11,23 +11,6 @@ type EventResult = {
1111 error ?: Error ;
1212} ;
1313
14- /**
15- * Checks if telemetry is currently enabled
16- * This is a method rather than a constant to capture runtime config changes
17- *
18- * Follows the Console Do Not Track standard (https://consoledonottrack.com/)
19- * by respecting the DO_NOT_TRACK environment variable
20- */
21- export function isTelemetryEnabled ( ) : boolean {
22- // Check if telemetry is explicitly disabled in config
23- if ( config . telemetry === "disabled" ) {
24- return false ;
25- }
26-
27- const doNotTrack = "DO_NOT_TRACK" in process . env ;
28- return ! doNotTrack ;
29- }
30-
3114export class Telemetry {
3215 private readonly commonProperties : CommonProperties ;
3316
@@ -46,7 +29,7 @@ export class Telemetry {
4629 */
4730 public async emitEvents ( events : BaseEvent [ ] ) : Promise < void > {
4831 try {
49- if ( ! isTelemetryEnabled ( ) ) {
32+ if ( ! this . isTelemetryEnabled ( ) ) {
5033 logger . info ( LogId . telemetryEmitFailure , "telemetry" , `Telemetry is disabled.` ) ;
5134 return ;
5235 }
@@ -72,6 +55,23 @@ export class Telemetry {
7255 } ;
7356 }
7457
58+ /**
59+ * Checks if telemetry is currently enabled
60+ * This is a method rather than a constant to capture runtime config changes
61+ *
62+ * Follows the Console Do Not Track standard (https://consoledonottrack.com/)
63+ * by respecting the DO_NOT_TRACK environment variable
64+ */
65+ public isTelemetryEnabled ( ) : boolean {
66+ // Check if telemetry is explicitly disabled in config
67+ if ( config . telemetry === "disabled" ) {
68+ return false ;
69+ }
70+
71+ const doNotTrack = "DO_NOT_TRACK" in process . env ;
72+ return ! doNotTrack ;
73+ }
74+
7575 /**
7676 * Attempts to emit events through authenticated and unauthenticated clients
7777 * Falls back to caching if both attempts fail
0 commit comments