Skip to content

Commit 69c6c7e

Browse files
authored
Add PyTorch profiler jump to source telemetry (microsoft#16129)
1 parent 23e7774 commit 69c6c7e

3 files changed

Lines changed: 17 additions & 0 deletions

File tree

src/client/telemetry/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ export enum EventName {
136136
TENSORBOARD_DETECTED_IN_INTEGRATED_TERMINAL = 'TENSORBOARD_DETECTED_IN_INTEGRATED_TERMINAL',
137137
TENSORBOARD_PACKAGE_INSTALL_RESULT = 'TENSORBOARD.PACKAGE_INSTALL_RESULT',
138138
TENSORBOARD_TORCH_PROFILER_IMPORT = 'TENSORBOARD.TORCH_PROFILER_IMPORT',
139+
TENSORBOARD_JUMP_TO_SOURCE_REQUEST = 'TENSORBOARD_JUMP_TO_SOURCE_REQUEST',
140+
TENSORBOARD_JUMP_TO_SOURCE_FILE_NOT_FOUND = 'TENSORBOARD_JUMP_TO_SOURCE_FILE_NOT_FOUND',
139141
}
140142

141143
export enum PlatformErrors {

src/client/telemetry/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1832,4 +1832,17 @@ export interface IEventNamePropertyMapping {
18321832
* `from torch import profiler`.
18331833
*/
18341834
[EventName.TENSORBOARD_TORCH_PROFILER_IMPORT]: never | undefined;
1835+
/**
1836+
* Telemetry event sent when the extension host receives a message from the
1837+
* TensorBoard webview containing a valid jump to source payload from the
1838+
* PyTorch profiler TensorBoard plugin.
1839+
*/
1840+
[EventName.TENSORBOARD_JUMP_TO_SOURCE_REQUEST]: never | undefined;
1841+
/**
1842+
* Telemetry event sent when the extension host receives a message from the
1843+
* TensorBoard webview containing a valid jump to source payload from the
1844+
* PyTorch profiler TensorBoard plugin, but the source file does not exist
1845+
* on the machine currently running TensorBoard.
1846+
*/
1847+
[EventName.TENSORBOARD_JUMP_TO_SOURCE_FILE_NOT_FOUND]: never | undefined;
18351848
}

src/client/tensorBoard/tensorBoardSession.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,10 +502,12 @@ export class TensorBoardSession {
502502
}
503503

504504
private async jumpToSource(fsPath: string, line: number) {
505+
sendTelemetryEvent(EventName.TENSORBOARD_JUMP_TO_SOURCE_REQUEST);
505506
let uri: Uri | undefined;
506507
if (fs.existsSync(fsPath)) {
507508
uri = Uri.file(fsPath);
508509
} else {
510+
sendTelemetryEvent(EventName.TENSORBOARD_JUMP_TO_SOURCE_FILE_NOT_FOUND);
509511
traceError(
510512
`Requested jump to source filepath ${fsPath} does not exist. Prompting user to select source file...`,
511513
);

0 commit comments

Comments
 (0)