Skip to content

Commit f66e839

Browse files
authored
telemetry cleanup (microsoft#241737)
remove telemetryservice
1 parent 87bf10c commit f66e839

File tree

3 files changed

+15
-64
lines changed

3 files changed

+15
-64
lines changed

src/vs/editor/contrib/codeAction/browser/codeActionController.ts

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,9 @@ import { IAction } from '../../../../base/common/actions.js';
1010
import { CancellationToken } from '../../../../base/common/cancellation.js';
1111
import { Color } from '../../../../base/common/color.js';
1212
import { onUnexpectedError } from '../../../../base/common/errors.js';
13+
import { HierarchicalKind } from '../../../../base/common/hierarchicalKind.js';
1314
import { Lazy } from '../../../../base/common/lazy.js';
1415
import { Disposable, MutableDisposable } from '../../../../base/common/lifecycle.js';
15-
import { ICodeEditor } from '../../../browser/editorBrowser.js';
16-
import { IPosition, Position } from '../../../common/core/position.js';
17-
import { IEditorContribution, ScrollType } from '../../../common/editorCommon.js';
18-
import { CodeActionTriggerType } from '../../../common/languages.js';
19-
import { IModelDeltaDecoration } from '../../../common/model.js';
20-
import { ModelDecorationOptions } from '../../../common/model/textModel.js';
21-
import { ILanguageFeaturesService } from '../../../common/services/languageFeatures.js';
22-
import { ApplyCodeActionReason, applyCodeAction } from './codeAction.js';
23-
import { CodeActionKeybindingResolver } from './codeActionKeybindingResolver.js';
24-
import { toMenuItems } from './codeActionMenu.js';
25-
import { LightBulbWidget } from './lightBulbWidget.js';
26-
import { MessageController } from '../../message/browser/messageController.js';
2716
import { localize } from '../../../../nls.js';
2817
import { IActionListDelegate } from '../../../../platform/actionWidget/browser/actionList.js';
2918
import { IActionWidgetService } from '../../../../platform/actionWidget/browser/actionWidget.js';
@@ -36,10 +25,20 @@ import { IEditorProgressService } from '../../../../platform/progress/common/pro
3625
import { editorFindMatchHighlight, editorFindMatchHighlightBorder } from '../../../../platform/theme/common/colorRegistry.js';
3726
import { isHighContrast } from '../../../../platform/theme/common/theme.js';
3827
import { registerThemingParticipant } from '../../../../platform/theme/common/themeService.js';
28+
import { ICodeEditor } from '../../../browser/editorBrowser.js';
29+
import { IPosition, Position } from '../../../common/core/position.js';
30+
import { IEditorContribution, ScrollType } from '../../../common/editorCommon.js';
31+
import { CodeActionTriggerType } from '../../../common/languages.js';
32+
import { IModelDeltaDecoration } from '../../../common/model.js';
33+
import { ModelDecorationOptions } from '../../../common/model/textModel.js';
34+
import { ILanguageFeaturesService } from '../../../common/services/languageFeatures.js';
35+
import { MessageController } from '../../message/browser/messageController.js';
3936
import { CodeActionAutoApply, CodeActionFilter, CodeActionItem, CodeActionKind, CodeActionSet, CodeActionTrigger, CodeActionTriggerSource } from '../common/types.js';
37+
import { ApplyCodeActionReason, applyCodeAction } from './codeAction.js';
38+
import { CodeActionKeybindingResolver } from './codeActionKeybindingResolver.js';
39+
import { toMenuItems } from './codeActionMenu.js';
4040
import { CodeActionModel, CodeActionsState } from './codeActionModel.js';
41-
import { HierarchicalKind } from '../../../../base/common/hierarchicalKind.js';
42-
import { ITelemetryService } from '../../../../platform/telemetry/common/telemetry.js';
41+
import { LightBulbWidget } from './lightBulbWidget.js';
4342

4443
interface IActionShowOptions {
4544
readonly includeDisabledActions?: boolean;
@@ -79,13 +78,12 @@ export class CodeActionController extends Disposable implements IEditorContribut
7978
@IConfigurationService private readonly _configurationService: IConfigurationService,
8079
@IActionWidgetService private readonly _actionWidgetService: IActionWidgetService,
8180
@IInstantiationService private readonly _instantiationService: IInstantiationService,
82-
@ITelemetryService private readonly _telemetryService: ITelemetryService,
8381
@IEditorProgressService private readonly _progressService: IEditorProgressService,
8482
) {
8583
super();
8684

8785
this._editor = editor;
88-
this._model = this._register(new CodeActionModel(this._editor, languageFeaturesService.codeActionProvider, markerService, contextKeyService, progressService, _configurationService, this._telemetryService));
86+
this._model = this._register(new CodeActionModel(this._editor, languageFeaturesService.codeActionProvider, markerService, contextKeyService, progressService, _configurationService));
8987
this._register(this._model.onDidChangeState(newState => this.update(newState)));
9088

9189
this._lightBulbWidget = new Lazy(() => {

src/vs/editor/contrib/codeAction/browser/codeActionModel.ts

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@ import { Emitter } from '../../../../base/common/event.js';
99
import { HierarchicalKind } from '../../../../base/common/hierarchicalKind.js';
1010
import { Disposable, IDisposable, MutableDisposable } from '../../../../base/common/lifecycle.js';
1111
import { isEqual } from '../../../../base/common/resources.js';
12-
import { StopWatch } from '../../../../base/common/stopwatch.js';
1312
import { URI } from '../../../../base/common/uri.js';
1413
import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js';
1514
import { IContextKey, IContextKeyService, RawContextKey } from '../../../../platform/contextkey/common/contextkey.js';
1615
import { IMarkerService } from '../../../../platform/markers/common/markers.js';
1716
import { IEditorProgressService, Progress } from '../../../../platform/progress/common/progress.js';
18-
import { ITelemetryService } from '../../../../platform/telemetry/common/telemetry.js';
1917
import { ICodeEditor } from '../../../browser/editorBrowser.js';
2018
import { EditorOption, ShowLightbulbIconMode } from '../../../common/config/editorOptions.js';
2119
import { Position } from '../../../common/core/position.js';
@@ -176,7 +174,6 @@ export class CodeActionModel extends Disposable {
176174
contextKeyService: IContextKeyService,
177175
private readonly _progressService?: IEditorProgressService,
178176
private readonly _configurationService?: IConfigurationService,
179-
private readonly _telemetryService?: ITelemetryService
180177
) {
181178
super();
182179
this._supportedCodeActions = SUPPORTED_CODE_ACTIONS.bindTo(contextKeyService);
@@ -328,29 +325,7 @@ export class CodeActionModel extends Disposable {
328325

329326
// Case for manual triggers - specifically Source Actions and Refactors
330327
if (trigger.trigger.type === CodeActionTriggerType.Invoke) {
331-
const sw = new StopWatch();
332328
const codeActions = await getCodeActions(this._registry, model, trigger.selection, trigger.trigger, Progress.None, token);
333-
334-
// Telemetry for duration of each code action on save.
335-
if (this._telemetryService) {
336-
type RenderActionMenu = {
337-
codeActions: number;
338-
duration: number;
339-
};
340-
341-
type RenderActionMenuClassification = {
342-
owner: 'justschen';
343-
comment: 'Information about how long it took for code actions to be received from the provider and shown in the UI.';
344-
codeActions: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Number of valid code actions received from TS.' };
345-
duration: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Duration it took for TS to return the action to run for each kind. ' };
346-
};
347-
348-
this._telemetryService.publicLog2<RenderActionMenu, RenderActionMenuClassification>('codeAction.invokedDurations', {
349-
codeActions: codeActions.validActions.length,
350-
duration: sw.elapsed()
351-
});
352-
}
353-
354329
return codeActions;
355330
}
356331

src/vs/workbench/contrib/codeEditor/browser/saveParticipants.ts

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import { CancellationToken, CancellationTokenSource } from '../../../../base/common/cancellation.js';
77
import { HierarchicalKind } from '../../../../base/common/hierarchicalKind.js';
88
import { Disposable } from '../../../../base/common/lifecycle.js';
9-
import { StopWatch } from '../../../../base/common/stopwatch.js';
109
import * as strings from '../../../../base/common/strings.js';
1110
import { IActiveCodeEditor, isCodeEditor } from '../../../../editor/browser/editorBrowser.js';
1211
import { ICodeEditorService } from '../../../../editor/browser/services/codeEditorService.js';
@@ -28,14 +27,13 @@ import { ExtensionIdentifier } from '../../../../platform/extensions/common/exte
2827
import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';
2928
import { IProgress, IProgressStep, Progress } from '../../../../platform/progress/common/progress.js';
3029
import { Registry } from '../../../../platform/registry/common/platform.js';
31-
import { ITelemetryService } from '../../../../platform/telemetry/common/telemetry.js';
3230
import { IWorkbenchContribution, IWorkbenchContributionsRegistry, Extensions as WorkbenchContributionsExtensions } from '../../../common/contributions.js';
3331
import { SaveReason } from '../../../common/editor.js';
34-
import { getModifiedRanges } from '../../format/browser/formatModified.js';
3532
import { IEditorService } from '../../../services/editor/common/editorService.js';
3633
import { IHostService } from '../../../services/host/browser/host.js';
3734
import { LifecyclePhase } from '../../../services/lifecycle/common/lifecycle.js';
3835
import { ITextFileEditorModel, ITextFileSaveParticipant, ITextFileSaveParticipantContext, ITextFileService } from '../../../services/textfile/common/textfiles.js';
36+
import { getModifiedRanges } from '../../format/browser/formatModified.js';
3937

4038
export class TrimWhitespaceParticipant implements ITextFileSaveParticipant {
4139

@@ -280,7 +278,6 @@ class CodeActionOnSaveParticipant extends Disposable implements ITextFileSavePar
280278
@IHostService private readonly hostService: IHostService,
281279
@IEditorService private readonly editorService: IEditorService,
282280
@ICodeEditorService private readonly codeEditorService: ICodeEditorService,
283-
@ITelemetryService private readonly telemetryService: ITelemetryService
284281
) {
285282
super();
286283

@@ -411,27 +408,8 @@ class CodeActionOnSaveParticipant extends Disposable implements ITextFileSavePar
411408
};
412409

413410
for (const codeActionKind of codeActionsOnSave) {
414-
const sw = new StopWatch();
415-
416411
const actionsToRun = await this.getActionsToRun(model, codeActionKind, excludes, getActionProgress, token);
417412

418-
// Telemetry for duration of each code action on save.
419-
type CodeActionOnSave = {
420-
codeAction: string;
421-
duration: number;
422-
};
423-
type CodeActionOnSaveClassification = {
424-
owner: 'justschen';
425-
comment: 'Information about the code action that was accepted on save.';
426-
codeAction: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Kind of the code action setting that is run.' };
427-
duration: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Duration it took for TS to return the action to run for each kind. ' };
428-
};
429-
430-
this.telemetryService.publicLog2<CodeActionOnSave, CodeActionOnSaveClassification>('codeAction.appliedOnSave', {
431-
codeAction: codeActionKind.value,
432-
duration: sw.elapsed()
433-
});
434-
435413
if (token.isCancellationRequested) {
436414
actionsToRun.dispose();
437415
return;

0 commit comments

Comments
 (0)