Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

notebook output performance #209282

Merged
merged 5 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,9 @@ export class BackLayerWebView<T extends ICommonCellInfo> extends Themable {
}
case 'notebookPerformanceMessage': {
this.notebookEditor.updatePerformanceMetadata(data.cellId, data.executionId, data.duration, data.rendererId);
if (data.mimeType && data.outputSize && data.rendererId === 'vscode.builtin-renderer') {
this._sendPerformanceData(data.mimeType, data.outputSize, data.duration);
}
break;
}
case 'outputInputFocus': {
Expand All @@ -927,6 +930,30 @@ export class BackLayerWebView<T extends ICommonCellInfo> extends Themable {
return initializePromise.p;
}

private _sendPerformanceData(mimeType: string, outputSize: number, renderTime: number) {
type NotebookOutputRenderClassification = {
owner: 'amunger';
comment: 'Track performance data for output rendering';
mimeType: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Presentation type of the output.' };
outputSize: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Size of the output data buffer.'; isMeasurement: true };
renderTime: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Time spent rendering output.'; isMeasurement: true };
};

type NotebookOutputRenderEvent = {
mimeType: string;
outputSize: number;
renderTime: number;
};

const telemetryData = {
mimeType,
outputSize,
renderTime
};

this.telemetryService.publicLog2<NotebookOutputRenderEvent, NotebookOutputRenderClassification>('NotebookCellOutputRender', telemetryData);
}

private _handleNotebookCellResource(uri: URI) {
const notebookResource = uri.path.length > 0 ? uri : this.documentUri;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,8 @@ export interface IPerformanceMessage extends BaseToWebviewMessage {
readonly cellId: string;
readonly duration: number;
readonly rendererId: string;
readonly outputSize?: number;
readonly mimeType?: string;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2699,7 +2699,21 @@ async function webviewPreloads(ctx: PreloadContext) {
outputElement/** outputNode */.element.style.visibility = data.initiallyHidden ? 'hidden' : '';

if (!!data.executionId && !!data.rendererId) {
postNotebookMessage<webviewMessages.IPerformanceMessage>('notebookPerformanceMessage', { cellId: data.cellId, executionId: data.executionId, duration: Date.now() - startTime, rendererId: data.rendererId });
let outputSize: number | undefined = undefined;
let mimeType: string | undefined = undefined;
if (data.content.type === 1 /* extension */) {
outputSize = data.content.output.valueBytes.length;
mimeType = data.content.output.mime;
}

postNotebookMessage<webviewMessages.IPerformanceMessage>('notebookPerformanceMessage', {
cellId: data.cellId,
executionId: data.executionId,
duration: Date.now() - startTime,
rendererId: data.rendererId,
outputSize,
mimeType
});
}
}

Expand Down
Loading