fixes telemetry levels

This commit is contained in:
SteVen Batten
2021-09-03 13:03:50 -07:00
parent 9408062d1a
commit 8fb7bbabf1
9 changed files with 13 additions and 13 deletions

View File

@@ -212,7 +212,7 @@ class SharedProcessMain extends Disposable {
let telemetryService: ITelemetryService;
let telemetryAppender: ITelemetryAppender;
let telemetryLevel = getTelemetryLevel(productService, environmentService);
if (telemetryLevel !== TelemetryLevel.NONE) {
if (telemetryLevel > TelemetryLevel.NONE) {
telemetryAppender = new TelemetryLogAppender(loggerService, environmentService);
const { appRoot, extensionsPath, installSourcePath } = environmentService;

View File

@@ -531,7 +531,7 @@ export class CodeApplication extends Disposable {
services.set(IURLService, new SyncDescriptor(NativeURLService));
// Telemetry
if (getTelemetryLevel(this.productService, this.environmentMainService) === TelemetryLevel.USER) {
if (getTelemetryLevel(this.productService, this.environmentMainService) >= TelemetryLevel.USER) {
const channel = getDelayedChannel(sharedProcessReady.then(client => client.getChannel('telemetryAppender')));
const appender = new TelemetryAppenderClient(channel);
const commonProperties = resolveCommonProperties(this.fileService, release(), hostname(), process.arch, this.productService.commit, this.productService.version, machineId, this.productService.msftInternalDomains, this.environmentMainService.installSourcePath);

View File

@@ -143,7 +143,7 @@ class CliMain extends Disposable {
// Telemetry
const appenders: AppInsightsAppender[] = [];
if (getTelemetryLevel(productService, environmentService) === TelemetryLevel.USER) {
if (getTelemetryLevel(productService, environmentService) >= TelemetryLevel.USER) {
if (productService.aiConfig && productService.aiConfig.asimovKey) {
appenders.push(new AppInsightsAppender('monacoworkbench', null, productService.aiConfig.asimovKey));
}

View File

@@ -939,7 +939,7 @@ export async function resolveMarketplaceHeaders(version: string, productService:
'User-Agent': `VSCode ${version}`
};
const uuid = await getServiceMachineId(environmentService, fileService, storageService);
if (getTelemetryLevel(productService, environmentService) === TelemetryLevel.USER && configurationService.getValue('telemetry.enableTelemetry') === true) {
if (getTelemetryLevel(productService, environmentService) >= TelemetryLevel.USER && configurationService.getValue('telemetry.enableTelemetry') === true) {
headers['X-Market-User-Id'] = uuid;
}
return headers;

View File

@@ -105,9 +105,9 @@ export function configurationTelemetry(telemetryService: ITelemetryService, conf
}
export const enum TelemetryLevel {
NONE,
LOG,
USER
NONE = 0,
LOG = 1,
USER = 2
}
/**

View File

@@ -30,7 +30,7 @@ export class MainThreadTelemetry extends Disposable implements MainThreadTelemet
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostTelemetry);
if (getTelemetryLevel(this._productService, this._environmenService) !== TelemetryLevel.NONE) {
if (getTelemetryLevel(this._productService, this._environmenService) > TelemetryLevel.NONE) {
this._register(this._configurationService.onDidChangeConfiguration(e => {
if (e.affectedKeys.includes('telemetry.enableTelemetry')) {
this._proxy.$onDidChangeTelemetryEnabled(this.telemetryEnabled);
@@ -42,7 +42,7 @@ export class MainThreadTelemetry extends Disposable implements MainThreadTelemet
}
private get telemetryEnabled(): boolean {
if (getTelemetryLevel(this._productService, this._environmenService) !== TelemetryLevel.USER) {
if (getTelemetryLevel(this._productService, this._environmenService) < TelemetryLevel.USER) {
return false;
}

View File

@@ -29,7 +29,7 @@ import { IWebviewWorkbenchService } from 'vs/workbench/contrib/webviewPanel/brow
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
import { ACTIVE_GROUP, IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { getTelemetryLevel } from 'vs/platform/telemetry/common/telemetryUtils';
import { getTelemetryLevel, TelemetryLevel } from 'vs/platform/telemetry/common/telemetryUtils';
export class ReleaseNotesManager {
@@ -195,7 +195,7 @@ export class ReleaseNotesManager {
}
private async addGAParameters(uri: URI, origin: string, experiment = '1'): Promise<URI> {
if (getTelemetryLevel(this._productService, this._environmentService)) {
if (getTelemetryLevel(this._productService, this._environmentService) >= TelemetryLevel.USER) {
if (uri.scheme === 'https' && uri.authority === 'code.visualstudio.com') {
const info = await this._telemetryService.getTelemetryInfo();

View File

@@ -51,7 +51,7 @@ class ExtensionResourceLoaderService implements IExtensionResourceLoaderService
'X-Client-Name': `${this._productService.applicationName}${isWeb ? '-web' : ''}`,
'X-Client-Version': this._productService.version
};
if (getTelemetryLevel(this._productService, this._environmentService) === TelemetryLevel.USER && this._configurationService.getValue('telemetry.enableTelemetry') === true) {
if (getTelemetryLevel(this._productService, this._environmentService) >= TelemetryLevel.USER && this._configurationService.getValue('telemetry.enableTelemetry') === true) {
requestInit.headers['X-Machine-Id'] = machineId;
}
if (this._productService.commit) {

View File

@@ -35,7 +35,7 @@ export class TelemetryService extends Disposable implements ITelemetryService {
) {
super();
if (getTelemetryLevel(productService, environmentService) === TelemetryLevel.LOG) {
if (getTelemetryLevel(productService, environmentService) >= TelemetryLevel.LOG) {
const channel = sharedProcessService.getChannel('telemetryAppender');
const config: ITelemetryServiceConfig = {
appender: new TelemetryAppenderClient(channel),