Enable logging only for ext test telemetry (#194056)

Attempt to enable logging only for ext test telemetry
This commit is contained in:
Logan Ramos
2023-09-25 15:13:33 -07:00
committed by GitHub
parent 1b5c0af328
commit 8a7288ffe4
4 changed files with 21 additions and 8 deletions

View File

@@ -56,7 +56,7 @@ import { ICustomEndpointTelemetryService, ITelemetryService } from 'vs/platform/
import { TelemetryAppenderChannel } from 'vs/platform/telemetry/common/telemetryIpc';
import { TelemetryLogAppender } from 'vs/platform/telemetry/common/telemetryLogAppender';
import { TelemetryService } from 'vs/platform/telemetry/common/telemetryService';
import { supportsTelemetry, ITelemetryAppender, NullAppender, NullTelemetryService, getPiiPathsFromEnvironment, isInternalTelemetry } from 'vs/platform/telemetry/common/telemetryUtils';
import { supportsTelemetry, ITelemetryAppender, NullAppender, NullTelemetryService, getPiiPathsFromEnvironment, isInternalTelemetry, isLoggingOnly } from 'vs/platform/telemetry/common/telemetryUtils';
import { CustomEndpointTelemetryService } from 'vs/platform/telemetry/node/customEndpointTelemetryService';
import { ExtensionStorageService, IExtensionStorageService } from 'vs/platform/extensionManagement/common/extensionStorage';
import { IgnoredExtensionsManagementService, IIgnoredExtensionsManagementService } from 'vs/platform/userDataSync/common/ignoredExtensions';
@@ -295,7 +295,7 @@ class SharedProcessMain extends Disposable implements IClientConnectionFilter {
if (supportsTelemetry(productService, environmentService)) {
const logAppender = new TelemetryLogAppender(logService, loggerService, environmentService, productService);
appenders.push(logAppender);
if (productService.aiConfig?.ariaKey) {
if (!isLoggingOnly(productService, environmentService) && productService.aiConfig?.ariaKey) {
const collectorAppender = new OneDataSystemAppender(requestService, internalTelemetry, 'monacoworkbench', null, productService.aiConfig.ariaKey);
this._register(toDisposable(() => collectorAppender.flush())); // Ensure the 1DS appender is disposed so that it flushes remaining data
appenders.push(collectorAppender);

View File

@@ -122,7 +122,7 @@ export function supportsTelemetry(productService: IProductService, environmentSe
if (!environmentService.isBuilt && !environmentService.disableTelemetry) {
return true;
}
return !(environmentService.disableTelemetry || !productService.enableTelemetry || environmentService.extensionTestsLocationURI);
return !(environmentService.disableTelemetry || !productService.enableTelemetry);
}
/**
@@ -133,6 +133,10 @@ export function supportsTelemetry(productService: IProductService, environmentSe
* @returns True if telemetry is actually disabled and we're only logging for debug purposes
*/
export function isLoggingOnly(productService: IProductService, environmentService: IEnvironmentService): boolean {
// If we're testing an extension, log telemetry for debug purposes
if (environmentService.extensionTestsLocationURI) {
return true;
}
// Logging only mode is only for OSS
if (environmentService.isBuilt) {
return false;

View File

@@ -44,7 +44,7 @@ import { RequestService } from 'vs/platform/request/node/requestService';
import { resolveCommonProperties } from 'vs/platform/telemetry/common/commonProperties';
import { ITelemetryService, TelemetryLevel } from 'vs/platform/telemetry/common/telemetry';
import { ITelemetryServiceConfig } from 'vs/platform/telemetry/common/telemetryService';
import { getPiiPathsFromEnvironment, isInternalTelemetry, ITelemetryAppender, NullAppender, supportsTelemetry } from 'vs/platform/telemetry/common/telemetryUtils';
import { getPiiPathsFromEnvironment, isInternalTelemetry, isLoggingOnly, ITelemetryAppender, NullAppender, supportsTelemetry } from 'vs/platform/telemetry/common/telemetryUtils';
import ErrorTelemetry from 'vs/platform/telemetry/node/errorTelemetry';
import { IPtyService, TerminalSettingId } from 'vs/platform/terminal/common/terminal';
import { PtyHostService } from 'vs/platform/terminal/node/ptyHostService';
@@ -148,7 +148,7 @@ export async function setupServerServices(connectionToken: ServerConnectionToken
let oneDsAppender: ITelemetryAppender = NullAppender;
const isInternal = isInternalTelemetry(productService, configurationService);
if (supportsTelemetry(productService, environmentService)) {
if (productService.aiConfig && productService.aiConfig.ariaKey) {
if (!isLoggingOnly(productService, environmentService) && productService.aiConfig?.ariaKey) {
oneDsAppender = new OneDataSystemAppender(requestService, isInternal, eventPrefix, null, productService.aiConfig.ariaKey);
disposables.add(toDisposable(() => oneDsAppender?.flush())); // Ensure the AI appender is disposed so that it flushes remaining data
}

View File

@@ -14,7 +14,7 @@ import { ClassifiedEvent, IGDPRProperty, OmitMetadata, StrictPropertyCheck } fro
import { ITelemetryData, ITelemetryService, TelemetryLevel, TELEMETRY_SETTING_ID } from 'vs/platform/telemetry/common/telemetry';
import { TelemetryLogAppender } from 'vs/platform/telemetry/common/telemetryLogAppender';
import { ITelemetryServiceConfig, TelemetryService as BaseTelemetryService } from 'vs/platform/telemetry/common/telemetryService';
import { getTelemetryLevel, isInternalTelemetry, ITelemetryAppender, NullTelemetryService, supportsTelemetry } from 'vs/platform/telemetry/common/telemetryUtils';
import { getTelemetryLevel, isInternalTelemetry, isLoggingOnly, ITelemetryAppender, NullTelemetryService, supportsTelemetry } from 'vs/platform/telemetry/common/telemetryUtils';
import { IBrowserWorkbenchEnvironmentService } from 'vs/workbench/services/environment/browser/environmentService';
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
import { resolveWorkbenchCommonProperties } from 'vs/workbench/services/telemetry/browser/workbenchCommonProperties';
@@ -71,8 +71,17 @@ export class TelemetryService extends Disposable implements ITelemetryService {
// If remote server is present send telemetry through that, else use the client side appender
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);
if (!isLoggingOnly(productService, environmentService)) {
if (remoteAgentService.getConnection() !== null) {
const remoteTelemetryProvider = {
log: remoteAgentService.logTelemetry.bind(remoteAgentService),
flush: remoteAgentService.flushTelemetry.bind(remoteAgentService)
};
appenders.push(remoteTelemetryProvider);
} else {
appenders.push(new OneDataSystemWebAppender(isInternal, 'monacoworkbench', null, productService.aiConfig?.ariaKey));
}
}
appenders.push(new TelemetryLogAppender(logService, loggerService, environmentService, productService));
const config: ITelemetryServiceConfig = {
appenders,