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

delete unwanted telemetry events #238130

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions src/vs/code/electron-utility/sharedProcess/sharedProcessMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ class SharedProcessMain extends Disposable implements IClientConnectionFilter {
instantiationService.invokeFunction(accessor => {
const logService = accessor.get(ILogService);
const telemetryService = accessor.get(ITelemetryService);
const userDataProfilesService = accessor.get(IUserDataProfilesService);

// Log info
logService.trace('sharedProcess configuration', JSON.stringify(this.configuration));
Expand All @@ -173,10 +172,6 @@ class SharedProcessMain extends Disposable implements IClientConnectionFilter {
// Error handler
this.registerErrorHandler(logService);

// Report Profiles Info
this.reportProfilesInfo(telemetryService, userDataProfilesService);
this._register(userDataProfilesService.onDidChangeProfiles(() => this.reportProfilesInfo(telemetryService, userDataProfilesService)));

// Report Client OS/DE Info
this.reportClientOSInfo(telemetryService, logService);
});
Expand Down Expand Up @@ -455,20 +450,6 @@ class SharedProcessMain extends Disposable implements IClientConnectionFilter {
});
}

private reportProfilesInfo(telemetryService: ITelemetryService, userDataProfilesService: IUserDataProfilesService): void {
type ProfilesInfoClassification = {
owner: 'sandy081';
comment: 'Report profiles information';
count: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Number of profiles' };
};
type ProfilesInfoEvent = {
count: number;
};
telemetryService.publicLog2<ProfilesInfoEvent, ProfilesInfoClassification>('profilesInfo', {
count: userDataProfilesService.profiles.length
});
}

private async reportClientOSInfo(telemetryService: ITelemetryService, logService: ILogService): Promise<void> {
if (isLinux) {
const [releaseInfo, displayProtocol] = await Promise.all([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { IUserDataProfilesService } from '../../userDataProfile/common/userDataP
import { IUriIdentityService } from '../../uriIdentity/common/uriIdentity.js';
import { Mutable, isObject, isString, isUndefined } from '../../../base/common/types.js';
import { getErrorMessage } from '../../../base/common/errors.js';
import { ITelemetryService } from '../../telemetry/common/telemetry.js';

interface IStoredProfileExtension {
identifier: IExtensionIdentifier;
Expand Down Expand Up @@ -110,7 +109,6 @@ export abstract class AbstractExtensionsProfileScannerService extends Disposable
@IFileService private readonly fileService: IFileService,
@IUserDataProfilesService private readonly userDataProfilesService: IUserDataProfilesService,
@IUriIdentityService private readonly uriIdentityService: IUriIdentityService,
@ITelemetryService private readonly telemetryService: ITelemetryService,
@ILogService private readonly logService: ILogService,
) {
super();
Expand Down Expand Up @@ -244,13 +242,13 @@ export abstract class AbstractExtensionsProfileScannerService extends Disposable
}
if (storedProfileExtensions) {
if (!Array.isArray(storedProfileExtensions)) {
this.reportAndThrowInvalidConentError(file);
this.throwInvalidConentError(file);
}
// TODO @sandy081: Remove this migration after couple of releases
let migrate = false;
for (const e of storedProfileExtensions) {
if (!isStoredProfileExtension(e)) {
this.reportAndThrowInvalidConentError(file);
this.throwInvalidConentError(file);
}
let location: URI;
if (isString(e.relativeLocation) && e.relativeLocation) {
Expand Down Expand Up @@ -302,15 +300,8 @@ export abstract class AbstractExtensionsProfileScannerService extends Disposable
});
}

private reportAndThrowInvalidConentError(file: URI): void {
type ErrorClassification = {
owner: 'sandy081';
comment: 'Information about the error that occurred while scanning';
code: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'error code' };
};
const error = new ExtensionsProfileScanningError(`Invalid extensions content in ${file.toString()}`, ExtensionsProfileScanningErrorCode.ERROR_INVALID_CONTENT);
this.telemetryService.publicLogError2<{ code: string }, ErrorClassification>('extensionsProfileScanningError', { code: error.code });
throw error;
private throwInvalidConentError(file: URI): void {
throw new ExtensionsProfileScanningError(`Invalid extensions content in ${file.toString()}`, ExtensionsProfileScanningErrorCode.ERROR_INVALID_CONTENT);
}

private toRelativePath(extensionLocation: URI): string | undefined {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import { ILogService } from '../../log/common/log.js';
import { IUserDataProfilesService } from '../../userDataProfile/common/userDataProfile.js';
import { IUriIdentityService } from '../../uriIdentity/common/uriIdentity.js';
import { ITelemetryService } from '../../telemetry/common/telemetry.js';
import { AbstractExtensionsProfileScannerService, IExtensionsProfileScannerService } from '../common/extensionsProfileScannerService.js';
import { IFileService } from '../../files/common/files.js';
import { INativeEnvironmentService } from '../../environment/common/environment.js';
Expand All @@ -19,10 +18,9 @@ export class ExtensionsProfileScannerService extends AbstractExtensionsProfileSc
@IFileService fileService: IFileService,
@IUserDataProfilesService userDataProfilesService: IUserDataProfilesService,
@IUriIdentityService uriIdentityService: IUriIdentityService,
@ITelemetryService telemetryService: ITelemetryService,
@ILogService logService: ILogService,
) {
super(URI.file(environmentService.extensionsPath), fileService, userDataProfilesService, uriIdentityService, telemetryService, logService);
super(URI.file(environmentService.extensionsPath), fileService, userDataProfilesService, uriIdentityService, logService);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import { ILogService } from '../../log/common/log.js';
import { IUserDataProfilesService } from '../../userDataProfile/common/userDataProfile.js';
import { IUriIdentityService } from '../../uriIdentity/common/uriIdentity.js';
import { ITelemetryService } from '../../telemetry/common/telemetry.js';
import { AbstractExtensionsProfileScannerService } from '../common/extensionsProfileScannerService.js';
import { IFileService } from '../../files/common/files.js';
import { INativeEnvironmentService } from '../../environment/common/environment.js';
Expand All @@ -18,9 +17,8 @@ export class ExtensionsProfileScannerService extends AbstractExtensionsProfileSc
@IFileService fileService: IFileService,
@IUserDataProfilesService userDataProfilesService: IUserDataProfilesService,
@IUriIdentityService uriIdentityService: IUriIdentityService,
@ITelemetryService telemetryService: ITelemetryService,
@ILogService logService: ILogService,
) {
super(URI.file(environmentService.extensionsPath), fileService, userDataProfilesService, uriIdentityService, telemetryService, logService);
super(URI.file(environmentService.extensionsPath), fileService, userDataProfilesService, uriIdentityService, logService);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { IInstantiationService } from '../../../instantiation/common/instantiati
import { TestInstantiationService } from '../../../instantiation/test/common/instantiationServiceMock.js';
import { ILogService, NullLogService } from '../../../log/common/log.js';
import { IProductService } from '../../../product/common/productService.js';
import { NullTelemetryService } from '../../../telemetry/common/telemetryUtils.js';
import { IUriIdentityService } from '../../../uriIdentity/common/uriIdentity.js';
import { UriIdentityService } from '../../../uriIdentity/common/uriIdentityService.js';
import { IUserDataProfilesService, UserDataProfilesService } from '../../../userDataProfile/common/userDataProfile.js';
Expand Down Expand Up @@ -81,7 +80,7 @@ suite('NativeExtensionsScanerService Test', () => {
instantiationService.stub(IUriIdentityService, uriIdentityService);
const userDataProfilesService = disposables.add(new UserDataProfilesService(environmentService, fileService, uriIdentityService, logService));
instantiationService.stub(IUserDataProfilesService, userDataProfilesService);
instantiationService.stub(IExtensionsProfileScannerService, disposables.add(new ExtensionsProfileScannerService(environmentService, fileService, userDataProfilesService, uriIdentityService, NullTelemetryService, logService)));
instantiationService.stub(IExtensionsProfileScannerService, disposables.add(new ExtensionsProfileScannerService(environmentService, fileService, userDataProfilesService, uriIdentityService, logService)));
await fileService.createFolder(systemExtensionsLocation);
await fileService.createFolder(userExtensionsLocation);
});
Expand Down
28 changes: 2 additions & 26 deletions src/vs/platform/files/browser/indexedDBFileSystemProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,10 @@ import { ExtUri } from '../../../base/common/resources.js';
import { isString } from '../../../base/common/types.js';
import { URI, UriDto } from '../../../base/common/uri.js';
import { localize } from '../../../nls.js';
import { createFileSystemProviderError, FileChangeType, IFileDeleteOptions, IFileOverwriteOptions, FileSystemProviderCapabilities, FileSystemProviderError, FileSystemProviderErrorCode, FileType, IFileWriteOptions, IFileChange, IFileSystemProviderWithFileReadWriteCapability, IStat, IWatchOptions } from '../common/files.js';
import { DBClosedError, IndexedDB } from '../../../base/browser/indexedDB.js';
import { createFileSystemProviderError, FileChangeType, IFileDeleteOptions, IFileOverwriteOptions, FileSystemProviderCapabilities, FileSystemProviderErrorCode, FileType, IFileWriteOptions, IFileChange, IFileSystemProviderWithFileReadWriteCapability, IStat, IWatchOptions } from '../common/files.js';
import { IndexedDB } from '../../../base/browser/indexedDB.js';
import { BroadcastDataChannel } from '../../../base/browser/broadcast.js';

export type IndexedDBFileSystemProviderErrorDataClassification = {
owner: 'sandy081';
comment: 'Information about errors that occur in the IndexedDB file system provider';
readonly scheme: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'IndexedDB file system provider scheme for which this error occurred' };
readonly operation: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'operation during which this error occurred' };
readonly code: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'error code' };
};

export type IndexedDBFileSystemProviderErrorData = {
readonly scheme: string;
readonly operation: string;
readonly code: string;
};

// Standard FS Errors (expected to be thrown in production when invalid FS operations are requested)
const ERR_FILE_NOT_FOUND = createFileSystemProviderError(localize('fileNotExists', "File does not exist"), FileSystemProviderErrorCode.FileNotFound);
const ERR_FILE_IS_DIR = createFileSystemProviderError(localize('fileIsDirectory', "File is Directory"), FileSystemProviderErrorCode.FileIsADirectory);
Expand Down Expand Up @@ -179,9 +165,6 @@ export class IndexedDBFileSystemProvider extends Disposable implements IFileSyst
private readonly _onDidChangeFile = this._register(new Emitter<readonly IFileChange[]>());
readonly onDidChangeFile: Event<readonly IFileChange[]> = this._onDidChangeFile.event;

private readonly _onReportError = this._register(new Emitter<IndexedDBFileSystemProviderErrorData>());
readonly onReportError = this._onReportError.event;

private readonly mtimes = new Map<string, number>();

private cachedFiletree: Promise<IndexedDBFileSystemNode> | undefined;
Expand Down Expand Up @@ -255,7 +238,6 @@ export class IndexedDBFileSystemProvider extends Disposable implements IFileSyst
return [...entry.children.entries()].map(([name, node]) => [name, node.type]);
}
} catch (error) {
this.reportError('readDir', error);
throw error;
}
}
Expand All @@ -277,7 +259,6 @@ export class IndexedDBFileSystemProvider extends Disposable implements IFileSyst

return buffer;
} catch (error) {
this.reportError('readFile', error);
throw error;
}
}
Expand All @@ -290,7 +271,6 @@ export class IndexedDBFileSystemProvider extends Disposable implements IFileSyst
}
await this.bulkWrite([[resource, content]]);
} catch (error) {
this.reportError('writeFile', error);
throw error;
}
}
Expand Down Expand Up @@ -452,8 +432,4 @@ export class IndexedDBFileSystemProvider extends Disposable implements IFileSyst
await this.indexedDB.runInTransaction(this.store, 'readwrite', objectStore => objectStore.clear());
}

private reportError(operation: string, error: Error): void {
this._onReportError.fire({ scheme: this.scheme, operation, code: error instanceof FileSystemProviderError || error instanceof DBClosedError ? error.code : 'unknown' });
}

}
8 changes: 0 additions & 8 deletions src/vs/platform/userDataSync/common/abstractSynchronizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@ import {
} from './userDataSync.js';
import { IUserDataProfile, IUserDataProfilesService } from '../../userDataProfile/common/userDataProfile.js';

type IncompatibleSyncSourceClassification = {
owner: 'sandy081';
comment: 'Information about the sync resource that is incompatible';
source: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'settings sync resource. eg., settings, keybindings...' };
};

export function isRemoteUserData(thing: any): thing is IRemoteUserData {
if (thing
&& (thing.ref !== undefined && typeof thing.ref === 'string' && thing.ref !== '')
Expand Down Expand Up @@ -325,8 +319,6 @@ export abstract class AbstractSynchroniser extends Disposable implements IUserDa

private async performSync(remoteUserData: IRemoteUserData, lastSyncUserData: IRemoteUserData | null, strategy: SyncStrategy, userDataSyncConfiguration: IUserDataSyncConfiguration): Promise<SyncStatus> {
if (remoteUserData.syncData && remoteUserData.syncData.version > this.version) {
// current version is not compatible with cloud version
this.telemetryService.publicLog2<{ source: string }, IncompatibleSyncSourceClassification>('sync/incompatible', { source: this.resource });
throw new UserDataSyncError(localize({ key: 'incompatible', comment: ['This is an error while syncing a resource that its local version is not compatible with its remote version.'] }, "Cannot sync {0} as its local version {1} is not compatible with its remote version {2}", this.resource, this.version, remoteUserData.syncData.version), UserDataSyncErrorCode.IncompatibleLocalContent, this.resource);
}

Expand Down
22 changes: 0 additions & 22 deletions src/vs/platform/userDataSync/common/userDataAutoSyncService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,6 @@ import { IUserDataSyncTask, IUserDataAutoSyncService, IUserDataManifest, IUserDa
import { IUserDataSyncAccountService } from './userDataSyncAccount.js';
import { IUserDataSyncMachinesService } from './userDataSyncMachines.js';

type AutoSyncClassification = {
owner: 'sandy081';
comment: 'Information about the sources triggering auto sync';
sources: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Source that triggered auto sync' };
providerId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Auth provider id used for sync' };
};

type AutoSyncErrorClassification = {
owner: 'sandy081';
comment: 'Information about the error that causes auto sync to fail';
code: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'error code' };
service: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Settings sync service for which this error has occurred' };
};

const disableMachineEventuallyKey = 'sync.disableMachineEventually';
const sessionIdKey = 'sync.sessionId';
const storeUrlKey = 'sync.storeUrl';
Expand Down Expand Up @@ -199,7 +185,6 @@ export class UserDataAutoSyncService extends Disposable implements IUserDataAuto

// Reset
if (everywhere) {
this.telemetryService.publicLog2<{}, { owner: 'sandy081'; comment: 'Reporting when settings sync is turned off in all devices' }>('sync/turnOffEveryWhere');
await this.userDataSyncService.reset();
} else {
await this.userDataSyncService.resetLocal();
Expand Down Expand Up @@ -235,11 +220,6 @@ export class UserDataAutoSyncService extends Disposable implements IUserDataAuto
// Error while syncing
const userDataSyncError = UserDataSyncError.toUserDataSyncError(error);

// Log to telemetry
if (userDataSyncError instanceof UserDataAutoSyncError) {
this.telemetryService.publicLog2<{ code: string; service: string }, AutoSyncErrorClassification>(`autosync/error`, { code: userDataSyncError.code, service: this.userDataSyncStoreManagementService.userDataSyncStore!.url.toString() });
}

// Session got expired
if (userDataSyncError.code === UserDataSyncErrorCode.SessionExpired) {
await this.turnOff(false, true /* force soft turnoff on error */);
Expand Down Expand Up @@ -361,8 +341,6 @@ export class UserDataAutoSyncService extends Disposable implements IUserDataAuto
this.sources.push(...sources);
return this.syncTriggerDelayer.trigger(async () => {
this.logService.trace('activity sources', ...this.sources);
const providerId = this.userDataSyncAccountService.account?.authenticationProviderId || '';
this.telemetryService.publicLog2<{ sources: string[]; providerId: string }, AutoSyncClassification>('sync/triggered', { sources: this.sources, providerId });
this.sources = [];
if (this.autoSync.value) {
await this.autoSync.value.sync('Activity', disableCache);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,8 @@ import { Disposable } from '../../../base/common/lifecycle.js';
import { isWeb } from '../../../base/common/platform.js';
import { IEnvironmentService } from '../../environment/common/environment.js';
import { IApplicationStorageValueChangeEvent, IStorageService, StorageScope, StorageTarget } from '../../storage/common/storage.js';
import { ITelemetryService } from '../../telemetry/common/telemetry.js';
import { ALL_SYNC_RESOURCES, getEnablementKey, IUserDataSyncEnablementService, IUserDataSyncStoreManagementService, SyncResource } from './userDataSync.js';

type SyncEnablementClassification = {
owner: 'sandy081';
comment: 'Reporting when Settings Sync is turned on or off';
enabled?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Flag indicating if settings sync is enabled or not' };
};

const enablementKey = 'sync.enable';

export class UserDataSyncEnablementService extends Disposable implements IUserDataSyncEnablementService {
Expand All @@ -31,7 +24,6 @@ export class UserDataSyncEnablementService extends Disposable implements IUserDa

constructor(
@IStorageService private readonly storageService: IStorageService,
@ITelemetryService private readonly telemetryService: ITelemetryService,
@IEnvironmentService protected readonly environmentService: IEnvironmentService,
@IUserDataSyncStoreManagementService private readonly userDataSyncStoreManagementService: IUserDataSyncStoreManagementService,
) {
Expand All @@ -57,7 +49,6 @@ export class UserDataSyncEnablementService extends Disposable implements IUserDa
if (enabled && !this.canToggleEnablement()) {
return;
}
this.telemetryService.publicLog2<{ enabled: boolean }, SyncEnablementClassification>(enablementKey, { enabled });
this.storageService.store(enablementKey, enabled, StorageScope.APPLICATION, StorageTarget.MACHINE);
}

Expand Down
Loading
Loading