Skip to content

Commit b108bc8

Browse files
authored
Fixes broken web telemetry (#159712)
Fixes web telemetry
1 parent 30eaec0 commit b108bc8

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/vs/workbench/services/telemetry/browser/telemetryService.ts

+5-9
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { ClassifiedEvent, IGDPRProperty, OmitMetadata, StrictPropertyCheck } fro
1515
import { ITelemetryData, ITelemetryInfo, ITelemetryService, TelemetryLevel, TELEMETRY_SETTING_ID } from 'vs/platform/telemetry/common/telemetry';
1616
import { TelemetryLogAppender } from 'vs/platform/telemetry/common/telemetryLogAppender';
1717
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';
1919
import { IBrowserWorkbenchEnvironmentService } from 'vs/workbench/services/environment/browser/environmentService';
2020
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
2121
import { resolveWorkbenchCommonProperties } from 'vs/workbench/services/telemetry/browser/workbenchCommonProperties';
@@ -24,7 +24,7 @@ export class TelemetryService extends Disposable implements ITelemetryService {
2424

2525
declare readonly _serviceBrand: undefined;
2626

27-
private impl: ITelemetryService;
27+
private impl: ITelemetryService = NullTelemetryService;
2828
public readonly sendErrorTelemetry = true;
2929

3030
constructor(
@@ -37,11 +37,7 @@ export class TelemetryService extends Disposable implements ITelemetryService {
3737
) {
3838
super();
3939

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);
4541

4642
// When the level changes it could change from off to on and we want to make sure telemetry is properly intialized
4743
this._register(configurationService.onDidChangeConfiguration(e => {
@@ -65,7 +61,7 @@ export class TelemetryService extends Disposable implements ITelemetryService {
6561
remoteAgentService: IRemoteAgentService
6662
) {
6763
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) {
6965
// If remote server is present send telemetry through that, else use the client side appender
7066
const appenders = [];
7167
const isInternal = isInternalTelemetry(productService, configurationService);
@@ -80,7 +76,7 @@ export class TelemetryService extends Disposable implements ITelemetryService {
8076

8177
return this._register(new BaseTelemetryService(config, configurationService, productService));
8278
}
83-
return NullTelemetryService;
79+
return this.impl;
8480
}
8581

8682
setExperimentProperty(name: string, value: string): void {

0 commit comments

Comments
 (0)