Skip to content

Commit eafc1e0

Browse files
authored
Remove overzealous telemetry (microsoft#165524)
1 parent 2d82025 commit eafc1e0

File tree

3 files changed

+2
-39
lines changed

3 files changed

+2
-39
lines changed

extensions/git/src/git.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import { detectEncoding } from './encoding';
1818
import { Ref, RefType, Branch, Remote, ForcePushMode, GitErrorCodes, LogOptions, Change, Status, CommitOptions, BranchQuery } from './api/git';
1919
import * as byline from 'byline';
2020
import { StringDecoder } from 'string_decoder';
21-
import TelemetryReporter from '@vscode/extension-telemetry';
2221

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

378-
private readonly telemetryReporter: TelemetryReporter;
379-
380-
constructor(options: IGitOptions, telemetryReporter: TelemetryReporter) {
377+
constructor(options: IGitOptions) {
381378
this.path = options.gitPath;
382379
this.version = options.version;
383380
this.userAgent = options.userAgent;
384381
this.env = options.env || {};
385-
this.telemetryReporter = telemetryReporter;
386382

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

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

570564
options.onSpawn?.(child);
571565

@@ -592,16 +586,6 @@ export class Git {
592586
}
593587
}
594588

595-
/* __GDPR__
596-
"git.execDuration" : {
597-
"owner": "lszomoru",
598-
"comment": "Time it takes to spawn and execute a git command",
599-
"durSpawn": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth","isMeasurement": true, "comment": "Time it took to run spawn git" },
600-
"durExec": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth","isMeasurement": true, "comment": "Time git took" }
601-
}
602-
*/
603-
this.telemetryReporter.sendTelemetryEvent('git.execDuration', undefined, { durSpawn, durExec });
604-
605589
let encoding = options.encoding || 'utf8';
606590
encoding = iconv.encodingExists(encoding) ? encoding : 'utf8';
607591

extensions/git/src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ async function createModel(context: ExtensionContext, logger: LogOutputChannel,
8585
userAgent: `git/${info.version} (${(os as any).version?.() ?? os.type()} ${os.release()}; ${os.platform()} ${os.arch()}) vscode/${vscodeVersion} (${env.appName})`,
8686
version: info.version,
8787
env: environment,
88-
}, telemetryReporter);
88+
});
8989
const model = new Model(git, askpass, context.globalState, logger, telemetryReporter);
9090
disposables.push(model);
9191

src/vs/platform/contextkey/browser/contextKeyService.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,13 @@ import { DisposableStore, IDisposable, MutableDisposable } from 'vs/base/common/
99
import { MarshalledObject } from 'vs/base/common/marshalling';
1010
import { MarshalledId } from 'vs/base/common/marshallingIds';
1111
import { cloneAndChange, distinct } from 'vs/base/common/objects';
12-
import { StopWatch } from 'vs/base/common/stopwatch';
1312
import { TernarySearchTree } from 'vs/base/common/ternarySearchTree';
1413
import { URI } from 'vs/base/common/uri';
1514
import { localize } from 'vs/nls';
1615
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
1716
import { ConfigurationTarget, IConfigurationService } from 'vs/platform/configuration/common/configuration';
1817
import { ContextKeyExpression, ContextKeyInfo, ContextKeyValue, IContext, IContextKey, IContextKeyChangeEvent, IContextKeyService, IContextKeyServiceTarget, IReadableSet, RawContextKey, SET_CONTEXT_COMMAND_ID } from 'vs/platform/contextkey/common/contextkey';
1918
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
20-
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
2119

2220
const KEYBINDING_CONTEXT_ATTR = 'data-keybinding-context';
2321

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

607605
export function setContext(accessor: ServicesAccessor, contextKey: any, contextValue: any) {
608606
const contextKeyService = accessor.get(IContextKeyService);
609-
const telemetryService = accessor.get(ITelemetryService);
610-
611-
const sw = new StopWatch(true);
612607
contextKeyService.createKey(String(contextKey), stringifyURIs(contextValue));
613-
const duration = sw.elapsed();
614-
615-
type TelemetryData = {
616-
duration: number;
617-
contextKey: string;
618-
};
619-
type TelemetryClassification = {
620-
owner: 'jrieken';
621-
comment: 'Performance numbers of the setContext-API command';
622-
duration: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'The time it took to set the context key' };
623-
contextKey: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; comment: 'The context key that got set' };
624-
};
625-
telemetryService.publicLog2<TelemetryData, TelemetryClassification>('command.setContext', {
626-
contextKey: String(contextKey),
627-
duration
628-
});
629608
}
630609

631610
function stringifyURIs(contextValue: any): any {

0 commit comments

Comments
 (0)