@@ -11,23 +11,6 @@ type EventResult = {
11
11
error ?: Error ;
12
12
} ;
13
13
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
-
31
14
export class Telemetry {
32
15
private readonly commonProperties : CommonProperties ;
33
16
@@ -46,7 +29,7 @@ export class Telemetry {
46
29
*/
47
30
public async emitEvents ( events : BaseEvent [ ] ) : Promise < void > {
48
31
try {
49
- if ( ! isTelemetryEnabled ( ) ) {
32
+ if ( ! this . isTelemetryEnabled ( ) ) {
50
33
logger . info ( LogId . telemetryEmitFailure , "telemetry" , `Telemetry is disabled.` ) ;
51
34
return ;
52
35
}
@@ -72,6 +55,23 @@ export class Telemetry {
72
55
} ;
73
56
}
74
57
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
+
75
75
/**
76
76
* Attempts to emit events through authenticated and unauthenticated clients
77
77
* Falls back to caching if both attempts fail
0 commit comments