Skip to content

Commit f64fab0

Browse files
authored
report perf for outputs within size window (microsoft#241728)
Co-authored-by: amunger <>
1 parent 5b99672 commit f64fab0

File tree

3 files changed

+13
-17
lines changed

3 files changed

+13
-17
lines changed

src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -930,8 +930,8 @@ export class BackLayerWebView<T extends ICommonCellInfo> extends Themable {
930930
}
931931
case 'notebookPerformanceMessage': {
932932
this.notebookEditor.updatePerformanceMetadata(data.cellId, data.executionId, data.duration, data.rendererId);
933-
if (data.mimeType && data.outputSize && data.rendererId === 'vscode.builtin-renderer') {
934-
this._sendPerformanceData(data.mimeType, data.outputSize, data.duration);
933+
if (data.outputSize && data.rendererId === 'vscode.builtin-renderer') {
934+
this._sendPerformanceData(data.outputSize, data.duration);
935935
}
936936
break;
937937
}
@@ -951,23 +951,20 @@ export class BackLayerWebView<T extends ICommonCellInfo> extends Themable {
951951
return initializePromise.p;
952952
}
953953

954-
private _sendPerformanceData(mimeType: string, outputSize: number, renderTime: number) {
954+
private _sendPerformanceData(outputSize: number, renderTime: number) {
955955
type NotebookOutputRenderClassification = {
956956
owner: 'amunger';
957957
comment: 'Track performance data for output rendering';
958-
mimeType: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Presentation type of the output.' };
959958
outputSize: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Size of the output data buffer.'; isMeasurement: true };
960959
renderTime: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Time spent rendering output.'; isMeasurement: true };
961960
};
962961

963962
type NotebookOutputRenderEvent = {
964-
mimeType: string;
965963
outputSize: number;
966964
renderTime: number;
967965
};
968966

969967
const telemetryData = {
970-
mimeType,
971968
outputSize,
972969
renderTime
973970
};

src/vs/workbench/contrib/notebook/browser/view/renderers/webviewMessages.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,6 @@ export interface IPerformanceMessage extends BaseToWebviewMessage {
486486
readonly duration: number;
487487
readonly rendererId: string;
488488
readonly outputSize?: number;
489-
readonly mimeType?: string;
490489
}
491490

492491

src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2733,20 +2733,20 @@ async function webviewPreloads(ctx: PreloadContext) {
27332733

27342734
if (!!data.executionId && !!data.rendererId) {
27352735
let outputSize: number | undefined = undefined;
2736-
let mimeType: string | undefined = undefined;
27372736
if (data.content.type === 1 /* extension */) {
27382737
outputSize = data.content.output.valueBytes.length;
2739-
mimeType = data.content.output.mime;
27402738
}
27412739

2742-
postNotebookMessage<webviewMessages.IPerformanceMessage>('notebookPerformanceMessage', {
2743-
cellId: data.cellId,
2744-
executionId: data.executionId,
2745-
duration: Date.now() - startTime,
2746-
rendererId: data.rendererId,
2747-
outputSize,
2748-
mimeType
2749-
});
2740+
// Only send performance messages for non-empty outputs up to a certain size
2741+
if (outputSize !== undefined && outputSize > 0 && outputSize < 100 * 1024) {
2742+
postNotebookMessage<webviewMessages.IPerformanceMessage>('notebookPerformanceMessage', {
2743+
cellId: data.cellId,
2744+
executionId: data.executionId,
2745+
duration: Date.now() - startTime,
2746+
rendererId: data.rendererId,
2747+
outputSize
2748+
});
2749+
}
27502750
}
27512751
}
27522752

0 commit comments

Comments
 (0)