diff options
Diffstat (limited to 'src/vs/workbench/api/browser/mainThreadTelemetry.ts')
-rw-r--r-- | src/vs/workbench/api/browser/mainThreadTelemetry.ts | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/vs/workbench/api/browser/mainThreadTelemetry.ts b/src/vs/workbench/api/browser/mainThreadTelemetry.ts index 58a919fc1e6..ac89aca9280 100644 --- a/src/vs/workbench/api/browser/mainThreadTelemetry.ts +++ b/src/vs/workbench/api/browser/mainThreadTelemetry.ts @@ -3,15 +3,14 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { ITelemetryService, TelemetryLevel, TELEMETRY_OLD_SETTING_ID, TELEMETRY_SETTING_ID } from 'vs/platform/telemetry/common/telemetry'; -import { MainThreadTelemetryShape, MainContext, ExtHostTelemetryShape, ExtHostContext } from '../common/extHost.protocol'; -import { extHostNamedCustomer, IExtHostContext } from 'vs/workbench/services/extensions/common/extHostCustomers'; -import { ClassifiedEvent, StrictPropertyCheck, GDPRClassification } from 'vs/platform/telemetry/common/gdprTypings'; import { Disposable } from 'vs/base/common/lifecycle'; -import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { IProductService } from 'vs/platform/product/common/productService'; -import { getTelemetryLevel, supportsTelemetry } from 'vs/platform/telemetry/common/telemetryUtils'; +import { ClassifiedEvent, GDPRClassification, StrictPropertyCheck } from 'vs/platform/telemetry/common/gdprTypings'; +import { ITelemetryService, TelemetryLevel } from 'vs/platform/telemetry/common/telemetry'; +import { supportsTelemetry } from 'vs/platform/telemetry/common/telemetryUtils'; +import { extHostNamedCustomer, IExtHostContext } from 'vs/workbench/services/extensions/common/extHostCustomers'; +import { ExtHostContext, ExtHostTelemetryShape, MainContext, MainThreadTelemetryShape } from '../common/extHost.protocol'; @extHostNamedCustomer(MainContext.MainThreadTelemetry) export class MainThreadTelemetry extends Disposable implements MainThreadTelemetryShape { @@ -22,7 +21,6 @@ export class MainThreadTelemetry extends Disposable implements MainThreadTelemet constructor( extHostContext: IExtHostContext, @ITelemetryService private readonly _telemetryService: ITelemetryService, - @IConfigurationService private readonly _configurationService: IConfigurationService, @IEnvironmentService private readonly _environmentService: IEnvironmentService, @IProductService private readonly _productService: IProductService ) { @@ -31,10 +29,8 @@ export class MainThreadTelemetry extends Disposable implements MainThreadTelemet this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostTelemetry); if (supportsTelemetry(this._productService, this._environmentService)) { - this._register(this._configurationService.onDidChangeConfiguration(e => { - if (e.affectsConfiguration(TELEMETRY_SETTING_ID) || e.affectsConfiguration(TELEMETRY_OLD_SETTING_ID)) { - this._proxy.$onDidChangeTelemetryLevel(this.telemetryLevel); - } + this._register(_telemetryService.telemetryLevel.onDidChange(level => { + this._proxy.$onDidChangeTelemetryLevel(level); })); } @@ -46,7 +42,7 @@ export class MainThreadTelemetry extends Disposable implements MainThreadTelemet return TelemetryLevel.NONE; } - return getTelemetryLevel(this._configurationService); + return this._telemetryService.telemetryLevel.value; } $publicLog(eventName: string, data: any = Object.create(null)): void { @@ -55,7 +51,7 @@ export class MainThreadTelemetry extends Disposable implements MainThreadTelemet this._telemetryService.publicLog(eventName, data); } - $publicLog2<E extends ClassifiedEvent<T> = never, T extends GDPRClassification<T> = never>(eventName: string, data: StrictPropertyCheck<T, E>): void { + $publicLog2<E extends ClassifiedEvent<T> = never, T extends GDPRClassification<T> = never>(eventName: string, data?: StrictPropertyCheck<T, E>): void { this.$publicLog(eventName, data as any); } } |