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

Remove overzealous telemetry #165524

Merged
merged 1 commit into from
Nov 4, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 1 addition & 17 deletions extensions/git/src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { detectEncoding } from './encoding';
import { Ref, RefType, Branch, Remote, ForcePushMode, GitErrorCodes, LogOptions, Change, Status, CommitOptions, BranchQuery } from './api/git';
import * as byline from 'byline';
import { StringDecoder } from 'string_decoder';
import TelemetryReporter from '@vscode/extension-telemetry';

// https://github.com/microsoft/vscode/issues/65693
const MAX_CLI_LENGTH = 30000;
Expand Down Expand Up @@ -375,14 +374,11 @@ export class Git {
private _onOutput = new EventEmitter();
get onOutput(): EventEmitter { return this._onOutput; }

private readonly telemetryReporter: TelemetryReporter;

constructor(options: IGitOptions, telemetryReporter: TelemetryReporter) {
constructor(options: IGitOptions) {
this.path = options.gitPath;
this.version = options.version;
this.userAgent = options.userAgent;
this.env = options.env || {};
this.telemetryReporter = telemetryReporter;

const onConfigurationChanged = (e?: ConfigurationChangeEvent) => {
if (e !== undefined && !e.affectsConfiguration('git.commandsToLog')) {
Expand Down Expand Up @@ -563,9 +559,7 @@ export class Git {
}

private async _exec(args: string[], options: SpawnOptions = {}): Promise<IExecutionResult<string>> {
const startSpawn = Date.now();
const child = this.spawn(args, options);
const durSpawn = Date.now() - startSpawn;

options.onSpawn?.(child);

Expand All @@ -592,16 +586,6 @@ export class Git {
}
}

/* __GDPR__
"git.execDuration" : {
"owner": "lszomoru",
"comment": "Time it takes to spawn and execute a git command",
"durSpawn": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth","isMeasurement": true, "comment": "Time it took to run spawn git" },
"durExec": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth","isMeasurement": true, "comment": "Time git took" }
}
*/
this.telemetryReporter.sendTelemetryEvent('git.execDuration', undefined, { durSpawn, durExec });

let encoding = options.encoding || 'utf8';
encoding = iconv.encodingExists(encoding) ? encoding : 'utf8';

Expand Down
2 changes: 1 addition & 1 deletion extensions/git/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ async function createModel(context: ExtensionContext, logger: LogOutputChannel,
userAgent: `git/${info.version} (${(os as any).version?.() ?? os.type()} ${os.release()}; ${os.platform()} ${os.arch()}) vscode/${vscodeVersion} (${env.appName})`,
version: info.version,
env: environment,
}, telemetryReporter);
});
const model = new Model(git, askpass, context.globalState, logger, telemetryReporter);
disposables.push(model);

Expand Down
21 changes: 0 additions & 21 deletions src/vs/platform/contextkey/browser/contextKeyService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@ import { DisposableStore, IDisposable, MutableDisposable } from 'vs/base/common/
import { MarshalledObject } from 'vs/base/common/marshalling';
import { MarshalledId } from 'vs/base/common/marshallingIds';
import { cloneAndChange, distinct } from 'vs/base/common/objects';
import { StopWatch } from 'vs/base/common/stopwatch';
import { TernarySearchTree } from 'vs/base/common/ternarySearchTree';
import { URI } from 'vs/base/common/uri';
import { localize } from 'vs/nls';
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
import { ConfigurationTarget, IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { ContextKeyExpression, ContextKeyInfo, ContextKeyValue, IContext, IContextKey, IContextKeyChangeEvent, IContextKeyService, IContextKeyServiceTarget, IReadableSet, RawContextKey, SET_CONTEXT_COMMAND_ID } from 'vs/platform/contextkey/common/contextkey';
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';

const KEYBINDING_CONTEXT_ATTR = 'data-keybinding-context';

Expand Down Expand Up @@ -606,26 +604,7 @@ function findContextAttr(domNode: IContextKeyServiceTarget | null): number {

export function setContext(accessor: ServicesAccessor, contextKey: any, contextValue: any) {
const contextKeyService = accessor.get(IContextKeyService);
const telemetryService = accessor.get(ITelemetryService);

const sw = new StopWatch(true);
contextKeyService.createKey(String(contextKey), stringifyURIs(contextValue));
const duration = sw.elapsed();

type TelemetryData = {
duration: number;
contextKey: string;
};
type TelemetryClassification = {
owner: 'jrieken';
comment: 'Performance numbers of the setContext-API command';
duration: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'The time it took to set the context key' };
contextKey: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'The context key that got set' };
};
telemetryService.publicLog2<TelemetryData, TelemetryClassification>('command.setContext', {
contextKey: String(contextKey),
duration
});
}

function stringifyURIs(contextValue: any): any {
Expand Down