Skip to content

Commit 8cf7bee

Browse files
authored
Merge pull request microsoft#61356 from Microsoft/telemetry-add-breakpoints
Add telemetry for debug add breakpoints microsoft#55514
2 parents ac643e1 + 6c55ec4 commit 8cf7bee

7 files changed

Lines changed: 28 additions & 9 deletions

File tree

src/vs/workbench/api/electron-browser/mainThreadDebugService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
133133
logMessage: l.logMessage
134134
}
135135
);
136-
this.debugService.addBreakpoints(uri.revive(dto.uri), rawbps);
136+
this.debugService.addBreakpoints(uri.revive(dto.uri), rawbps, 'extension');
137137
} else if (dto.type === 'function') {
138138
this.debugService.addFunctionBreakpoint(dto.functionName, dto.id);
139139
}

src/vs/workbench/parts/debug/browser/debugCommands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ export function registerCommands(): void {
211211
return Promise.resolve(null);
212212
}
213213
if (debugService.getConfigurationManager().canSetBreakpointsIn(widget.getModel())) {
214-
return debugService.addBreakpoints(modelUri, [{ lineNumber: position.lineNumber, column: position.column > 1 ? position.column : undefined }]);
214+
return debugService.addBreakpoints(modelUri, [{ lineNumber: position.lineNumber, column: position.column > 1 ? position.column : undefined }], 'debugCommands.inlineBreakpointCommand');
215215
}
216216
}
217217

src/vs/workbench/parts/debug/browser/debugEditorActions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class ToggleBreakpointAction extends EditorAction {
4545
return Promise.all(bps.map(bp => debugService.removeBreakpoints(bp.getId())));
4646
}
4747
if (debugService.getConfigurationManager().canSetBreakpointsIn(editor.getModel())) {
48-
return debugService.addBreakpoints(modelUri, [{ lineNumber: position.lineNumber }]);
48+
return debugService.addBreakpoints(modelUri, [{ lineNumber: position.lineNumber }], 'debugEditorActions.toggleBreakpointAction');
4949
}
5050

5151
return Promise.resolve(null);
@@ -130,7 +130,7 @@ class RunToCursorAction extends EditorAction {
130130
const position = editor.getPosition();
131131
const uri = editor.getModel().uri;
132132
const bpExists = !!(debugService.getModel().getBreakpoints({ column: position.column, lineNumber: position.lineNumber, uri }).length);
133-
return (bpExists ? Promise.resolve(null) : <Promise<any>>debugService.addBreakpoints(uri, [{ lineNumber: position.lineNumber, column: position.column }])).then((breakpoints) => {
133+
return (bpExists ? Promise.resolve(null) : <Promise<any>>debugService.addBreakpoints(uri, [{ lineNumber: position.lineNumber, column: position.column }], 'debugEditorActions.runToCursorAction')).then((breakpoints) => {
134134
if (breakpoints && breakpoints.length) {
135135
breakpointToRemove = breakpoints[0];
136136
}

src/vs/workbench/parts/debug/common/debug.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ export interface IDebugService {
676676
/**
677677
* Adds new breakpoints to the model for the file specified with the uri. Notifies debug adapter of breakpoint changes.
678678
*/
679-
addBreakpoints(uri: uri, rawBreakpoints: IBreakpointData[]): TPromise<IBreakpoint[]>;
679+
addBreakpoints(uri: uri, rawBreakpoints: IBreakpointData[], context: string): TPromise<IBreakpoint[]>;
680680

681681
/**
682682
* Updates the breakpoints.

src/vs/workbench/parts/debug/electron-browser/breakpointWidget.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ export class BreakpointWidget extends ZoneWidget implements IPrivateBreakpointWi
183183
condition,
184184
hitCondition,
185185
logMessage
186-
}]);
186+
}], `breakpointWidget`);
187187
}
188188
}
189189

src/vs/workbench/parts/debug/electron-browser/debugEditorContribution.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export class DebugEditorContribution implements IDebugEditorContribution {
148148
nls.localize('addBreakpoint', "Add Breakpoint"),
149149
null,
150150
true,
151-
() => this.debugService.addBreakpoints(uri, [{ lineNumber }])
151+
() => this.debugService.addBreakpoints(uri, [{ lineNumber }], `debugEditorContextMenu`)
152152
));
153153
actions.push(new Action(
154154
'addConditionalBreakpoint',
@@ -230,7 +230,7 @@ export class DebugEditorContribution implements IDebugEditorContribution {
230230
breakpoints.forEach(bp => this.debugService.removeBreakpoints(bp.getId()));
231231
}
232232
} else if (canSetBreakpoints) {
233-
this.debugService.addBreakpoints(uri, [{ lineNumber }]);
233+
this.debugService.addBreakpoints(uri, [{ lineNumber }], `debugEditorGutter`);
234234
}
235235
}
236236
}));

src/vs/workbench/parts/debug/electron-browser/debugService.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,9 +822,10 @@ export class DebugService implements IDebugService {
822822
return this.sendAllBreakpoints();
823823
}
824824

825-
addBreakpoints(uri: uri, rawBreakpoints: IBreakpointData[]): TPromise<IBreakpoint[]> {
825+
addBreakpoints(uri: uri, rawBreakpoints: IBreakpointData[], context: string): TPromise<IBreakpoint[]> {
826826
const breakpoints = this.model.addBreakpoints(uri, rawBreakpoints);
827827
breakpoints.forEach(bp => aria.status(nls.localize('breakpointAdded', "Added breakpoint, line {0}, file {1}", bp.lineNumber, uri.fsPath)));
828+
breakpoints.forEach(bp => this.telemetryDebugAddBreakpoint(bp, context));
828829

829830
return this.sendBreakpoints(uri).then(() => breakpoints);
830831
}
@@ -1064,4 +1065,22 @@ export class DebugService implements IDebugService {
10641065
error: message
10651066
});
10661067
}
1068+
1069+
private telemetryDebugAddBreakpoint(breakpoint: IBreakpoint, context: string): TPromise<any> {
1070+
/* __GDPR__
1071+
"debugAddBreakpoint" : {
1072+
"context": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
1073+
"hasCondition": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
1074+
"hasHitCondition": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
1075+
"hasLogMessage": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
1076+
}
1077+
*/
1078+
1079+
return this.telemetryService.publicLog('debugAddBreakpoint', {
1080+
context: context,
1081+
hasCondition: !!breakpoint.condition,
1082+
hasHitCondition: !!breakpoint.hitCondition,
1083+
hasLogMessage: !!breakpoint.logMessage
1084+
});
1085+
}
10671086
}

0 commit comments

Comments
 (0)