44 *--------------------------------------------------------------------------------------------*/
55
66import { Disposable } from 'vs/base/common/lifecycle' ;
7+ import { IConfigurationService } from 'vs/platform/configuration/common/configuration' ;
78import { IEnvironmentService } from 'vs/platform/environment/common/environment' ;
89import { IProductService } from 'vs/platform/product/common/productService' ;
910import { ClassifiedEvent , IGDPRProperty , OmitMetadata , StrictPropertyCheck } from 'vs/platform/telemetry/common/gdprTypings' ;
10- import { ITelemetryService , TelemetryLevel } from 'vs/platform/telemetry/common/telemetry' ;
11+ import { ITelemetryService , TelemetryLevel , TELEMETRY_OLD_SETTING_ID , TELEMETRY_SETTING_ID } from 'vs/platform/telemetry/common/telemetry' ;
1112import { isLoggingOnly , supportsTelemetry } from 'vs/platform/telemetry/common/telemetryUtils' ;
1213import { extHostNamedCustomer , IExtHostContext } from 'vs/workbench/services/extensions/common/extHostCustomers' ;
1314import { ExtHostContext , ExtHostTelemetryShape , MainContext , MainThreadTelemetryShape } from '../common/extHost.protocol' ;
@@ -21,6 +22,7 @@ export class MainThreadTelemetry extends Disposable implements MainThreadTelemet
2122 constructor (
2223 extHostContext : IExtHostContext ,
2324 @ITelemetryService private readonly _telemetryService : ITelemetryService ,
25+ @IConfigurationService private readonly _configurationService : IConfigurationService ,
2426 @IEnvironmentService private readonly _environmentService : IEnvironmentService ,
2527 @IProductService private readonly _productService : IProductService ,
2628 ) {
@@ -29,8 +31,10 @@ export class MainThreadTelemetry extends Disposable implements MainThreadTelemet
2931 this . _proxy = extHostContext . getProxy ( ExtHostContext . ExtHostTelemetry ) ;
3032
3133 if ( supportsTelemetry ( this . _productService , this . _environmentService ) ) {
32- this . _register ( _telemetryService . telemetryLevel . onDidChange ( level => {
33- this . _proxy . $onDidChangeTelemetryLevel ( level ) ;
34+ this . _register ( this . _configurationService . onDidChangeConfiguration ( e => {
35+ if ( e . affectsConfiguration ( TELEMETRY_SETTING_ID ) || e . affectsConfiguration ( TELEMETRY_OLD_SETTING_ID ) ) {
36+ this . _proxy . $onDidChangeTelemetryLevel ( this . telemetryLevel ) ;
37+ }
3438 } ) ) ;
3539 }
3640 const loggingOnly = isLoggingOnly ( this . _productService , this . _environmentService ) ;
@@ -42,7 +46,7 @@ export class MainThreadTelemetry extends Disposable implements MainThreadTelemet
4246 return TelemetryLevel . NONE ;
4347 }
4448
45- return this . _telemetryService . telemetryLevel . value ;
49+ return this . _telemetryService . telemetryLevel ;
4650 }
4751
4852 $publicLog ( eventName : string , data : any = Object . create ( null ) ) : void {
0 commit comments