Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debt - use ITelemetryAppender interface #167067

Merged
merged 1 commit into from Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/vs/code/node/cliProcessMain.ts
Expand Up @@ -53,7 +53,7 @@ import { StateService } from 'vs/platform/state/node/stateService';
import { resolveCommonProperties } from 'vs/platform/telemetry/common/commonProperties';
import { ITelemetryService, machineIdKey } from 'vs/platform/telemetry/common/telemetry';
import { ITelemetryServiceConfig, TelemetryService } from 'vs/platform/telemetry/common/telemetryService';
import { supportsTelemetry, NullTelemetryService, getPiiPathsFromEnvironment, isInternalTelemetry } from 'vs/platform/telemetry/common/telemetryUtils';
import { supportsTelemetry, NullTelemetryService, getPiiPathsFromEnvironment, isInternalTelemetry, ITelemetryAppender } from 'vs/platform/telemetry/common/telemetryUtils';
import { OneDataSystemAppender } from 'vs/platform/telemetry/node/1dsAppender';
import { buildTelemetryMessage } from 'vs/platform/telemetry/node/telemetry';
import { IUriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentity';
Expand Down Expand Up @@ -105,7 +105,7 @@ class CliMain extends Disposable {
});
}

private async initServices(): Promise<[IInstantiationService, OneDataSystemAppender[]]> {
private async initServices(): Promise<[IInstantiationService, ITelemetryAppender[]]> {
const services = new ServiceCollection();

// Product
Expand Down Expand Up @@ -190,7 +190,7 @@ class CliMain extends Disposable {
services.set(ILanguagePackService, new SyncDescriptor(NativeLanguagePackService, undefined, false));

// Telemetry
const appenders: OneDataSystemAppender[] = [];
const appenders: ITelemetryAppender[] = [];
const isInternal = isInternalTelemetry(productService, configurationService);
if (supportsTelemetry(productService, environmentService)) {
if (productService.aiConfig && productService.aiConfig.ariaKey) {
Expand Down
4 changes: 2 additions & 2 deletions src/vs/platform/windows/electron-main/windowImpl.ts
Expand Up @@ -46,7 +46,7 @@ import { IUserDataProfilesMainService } from 'vs/platform/userDataProfile/electr
import { INativeHostMainService } from 'vs/platform/native/electron-main/nativeHostMainService';
import { OneDataSystemAppender } from 'vs/platform/telemetry/node/1dsAppender';
import { ITelemetryServiceConfig, TelemetryService } from 'vs/platform/telemetry/common/telemetryService';
import { getPiiPathsFromEnvironment, isInternalTelemetry, supportsTelemetry } from 'vs/platform/telemetry/common/telemetryUtils';
import { getPiiPathsFromEnvironment, isInternalTelemetry, ITelemetryAppender, supportsTelemetry } from 'vs/platform/telemetry/common/telemetryUtils';
import { Promises } from 'vs/base/node/pfs';
import { resolveCommonProperties } from 'vs/platform/telemetry/common/commonProperties';
import { hostname, release } from 'os';
Expand Down Expand Up @@ -772,7 +772,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
private async handleWindowsAdminCrash(details: { reason: string; exitCode: number }) {

// Prepare telemetry event (TODO@bpasero remove me eventually)
const appenders: OneDataSystemAppender[] = [];
const appenders: ITelemetryAppender[] = [];
const isInternal = isInternalTelemetry(this.productService, this.configurationService);
if (supportsTelemetry(this.productService, this.environmentMainService)) {
if (this.productService.aiConfig && this.productService.aiConfig.ariaKey) {
Expand Down
Expand Up @@ -63,7 +63,7 @@ export class TelemetryService extends Disposable implements ITelemetryService {
const telemetrySupported = supportsTelemetry(productService, environmentService) && productService.aiConfig?.ariaKey;
if (telemetrySupported && getTelemetryLevel(configurationService) !== TelemetryLevel.NONE && this.impl === NullTelemetryService) {
// If remote server is present send telemetry through that, else use the client side appender
const appenders = [];
const appenders: ITelemetryAppender[] = [];
const isInternal = isInternalTelemetry(productService, configurationService);
const telemetryProvider: ITelemetryAppender = remoteAgentService.getConnection() !== null ? { log: remoteAgentService.logTelemetry.bind(remoteAgentService), flush: remoteAgentService.flushTelemetry.bind(remoteAgentService) } : new OneDataSystemWebAppender(isInternal, 'monacoworkbench', null, productService.aiConfig?.ariaKey);
appenders.push(telemetryProvider);
Expand Down