@@ -15,7 +15,7 @@ import { ClassifiedEvent, IGDPRProperty, OmitMetadata, StrictPropertyCheck } fro
15
15
import { ITelemetryData , ITelemetryInfo , ITelemetryService , TelemetryLevel , TELEMETRY_SETTING_ID } from 'vs/platform/telemetry/common/telemetry' ;
16
16
import { TelemetryLogAppender } from 'vs/platform/telemetry/common/telemetryLogAppender' ;
17
17
import { ITelemetryServiceConfig , TelemetryService as BaseTelemetryService } from 'vs/platform/telemetry/common/telemetryService' ;
18
- import { isInternalTelemetry , ITelemetryAppender , NullTelemetryService , supportsTelemetry } from 'vs/platform/telemetry/common/telemetryUtils' ;
18
+ import { getTelemetryLevel , isInternalTelemetry , ITelemetryAppender , NullTelemetryService , supportsTelemetry } from 'vs/platform/telemetry/common/telemetryUtils' ;
19
19
import { IBrowserWorkbenchEnvironmentService } from 'vs/workbench/services/environment/browser/environmentService' ;
20
20
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService' ;
21
21
import { resolveWorkbenchCommonProperties } from 'vs/workbench/services/telemetry/browser/workbenchCommonProperties' ;
@@ -24,7 +24,7 @@ export class TelemetryService extends Disposable implements ITelemetryService {
24
24
25
25
declare readonly _serviceBrand : undefined ;
26
26
27
- private impl : ITelemetryService ;
27
+ private impl : ITelemetryService = NullTelemetryService ;
28
28
public readonly sendErrorTelemetry = true ;
29
29
30
30
constructor (
@@ -37,11 +37,7 @@ export class TelemetryService extends Disposable implements ITelemetryService {
37
37
) {
38
38
super ( ) ;
39
39
40
- if ( supportsTelemetry ( productService , environmentService ) && productService . aiConfig ?. ariaKey ) {
41
- this . impl = this . initializeService ( environmentService , loggerService , configurationService , storageService , productService , remoteAgentService ) ;
42
- } else {
43
- this . impl = NullTelemetryService ;
44
- }
40
+ this . impl = this . initializeService ( environmentService , loggerService , configurationService , storageService , productService , remoteAgentService ) ;
45
41
46
42
// When the level changes it could change from off to on and we want to make sure telemetry is properly intialized
47
43
this . _register ( configurationService . onDidChangeConfiguration ( e => {
@@ -65,7 +61,7 @@ export class TelemetryService extends Disposable implements ITelemetryService {
65
61
remoteAgentService : IRemoteAgentService
66
62
) {
67
63
const telemetrySupported = supportsTelemetry ( productService , environmentService ) && productService . aiConfig ?. ariaKey ;
68
- if ( telemetrySupported && this . impl === NullTelemetryService && this . telemetryLevel . value !== TelemetryLevel . NONE ) {
64
+ if ( telemetrySupported && getTelemetryLevel ( configurationService ) !== TelemetryLevel . NONE && this . impl === NullTelemetryService ) {
69
65
// If remote server is present send telemetry through that, else use the client side appender
70
66
const appenders = [ ] ;
71
67
const isInternal = isInternalTelemetry ( productService , configurationService ) ;
@@ -80,7 +76,7 @@ export class TelemetryService extends Disposable implements ITelemetryService {
80
76
81
77
return this . _register ( new BaseTelemetryService ( config , configurationService , productService ) ) ;
82
78
}
83
- return NullTelemetryService ;
79
+ return this . impl ;
84
80
}
85
81
86
82
setExperimentProperty ( name : string , value : string ) : void {
0 commit comments