Skip to content

Commit a2d1af0

Browse files
committed
feat: send description to compare performance view
1 parent 65113e0 commit a2d1af0

File tree

4 files changed

+36
-8
lines changed

4 files changed

+36
-8
lines changed

extensions/ql-vscode/src/common/interface-types.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ import type {
2727
} from "./raw-result-types";
2828
import type { AccessPathSuggestionOptions } from "../model-editor/suggestions";
2929
import type { ModelEvaluationRunState } from "../model-editor/shared/model-evaluation-run-state";
30-
import type { PerformanceComparisonDataFromLog } from "../log-insights/performance-comparison";
30+
import type {
31+
ComparePerformanceDescriptionData,
32+
PerformanceComparisonDataFromLog,
33+
} from "../log-insights/performance-comparison";
3134

3235
/**
3336
* This module contains types and code that are shared between
@@ -398,9 +401,9 @@ export interface SetComparisonsMessage {
398401
}
399402

400403
export type ToComparePerformanceViewMessage = SetPerformanceComparisonQueries;
401-
402404
export interface SetPerformanceComparisonQueries {
403405
readonly t: "setPerformanceComparison";
406+
readonly description: ComparePerformanceDescriptionData;
404407
readonly from: PerformanceComparisonDataFromLog;
405408
readonly to: PerformanceComparisonDataFromLog;
406409
}

extensions/ql-vscode/src/compare-performance/compare-performance-view.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { AbstractWebview } from "../common/vscode/abstract-webview";
1515
import { telemetryListener } from "../common/vscode/telemetry";
1616
import type { ResultsView } from "../local-queries";
1717
import { scanLog } from "../log-insights/log-scanner";
18+
import type { ComparePerformanceDescriptionData } from "../log-insights/performance-comparison";
1819
import { PerformanceOverviewScanner } from "../log-insights/performance-comparison";
1920
import type { HistoryItemLabelProvider } from "../query-history/history-item-label-provider";
2021
import { RemoteLogs } from "./remote-logs";
@@ -43,7 +44,11 @@ export class ComparePerformanceView extends AbstractWebview<
4344
);
4445
}
4546

46-
async showResults(fromJsonLog: string, toJsonLog: string) {
47+
async showResults(
48+
fromJsonLog: string,
49+
toJsonLog: string,
50+
description: ComparePerformanceDescriptionData,
51+
) {
4752
const panel = await this.getPanel();
4853
panel.reveal(undefined, false);
4954

@@ -65,6 +70,7 @@ export class ComparePerformanceView extends AbstractWebview<
6570

6671
await this.postMessage({
6772
t: "setPerformanceComparison",
73+
description,
6874
from: fromPerf.getData(),
6975
to: toPerf.getData(),
7076
});
@@ -125,6 +131,6 @@ export class ComparePerformanceView extends AbstractWebview<
125131
);
126132
return;
127133
}
128-
await this.showResults(result.before, result.after);
134+
await this.showResults(result.before, result.after, result.description);
129135
}
130136
}

extensions/ql-vscode/src/compare-performance/remote-logs.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { reportStreamProgress, withProgress } from "../common/vscode/progress";
2323
import { downloadTimeout, GITHUB_URL } from "../config";
2424
import { QueryOutputDir } from "../local-queries/query-output-dir";
2525
import { tmpDir } from "../tmp-dir";
26+
import type { ComparePerformanceDescriptionData } from "../log-insights/performance-comparison";
2627

2728
export class RemoteLogs {
2829
private LOG_DOWNLOAD_AND_PROCESS_PROGRESS_STEPS = 4;
@@ -252,6 +253,7 @@ export class RemoteLogs {
252253
| {
253254
before: string;
254255
after: string;
256+
description: ComparePerformanceDescriptionData;
255257
}
256258
| undefined
257259
> {
@@ -268,7 +270,11 @@ export class RemoteLogs {
268270
if (processed.some((d) => typeof d === "undefined")) {
269271
throw new Error("Silently failed to download or process some logs!?");
270272
}
271-
return { before: processed[0]!, after: processed[1]! };
273+
return {
274+
before: processed[0]!,
275+
after: processed[1]!,
276+
description: picked.description,
277+
};
272278
}
273279

274280
/**
@@ -638,6 +644,7 @@ export class RemoteLogs {
638644
| {
639645
before: ArtifactDownload;
640646
after: ArtifactDownload;
647+
description: ComparePerformanceDescriptionData;
641648
}
642649
| undefined
643650
> {
@@ -717,10 +724,18 @@ export class RemoteLogs {
717724
void extLogger.log(
718725
`Picked ${experimentChoice} ${targetChoice1} ${targetChoice2}`,
719726
);
727+
const targetInfoChoice2 = targetInfos.find(
728+
(t) => t.info.target_id === targetChoice2,
729+
)!;
720730
return {
721731
before: targetInfoChoice1.downloads["evaluator-logs"],
722-
after: targetInfos.find((t) => t.info.target_id === targetChoice2)!
723-
.downloads["evaluator-logs"],
732+
after: targetInfoChoice2.downloads["evaluator-logs"],
733+
description: {
734+
kind: "remote-logs",
735+
experimentName: experimentChoice,
736+
fromTarget: targetInfoChoice1,
737+
toTarget: targetInfoChoice2,
738+
},
724739
};
725740
}
726741
}

extensions/ql-vscode/src/extension.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1223,7 +1223,11 @@ async function showPerformanceComparison(
12231223
`Comparing performance of ${from.getQueryName()} and ${to.getQueryName()}`,
12241224
);
12251225

1226-
await view.showResults(fromLog, toLog);
1226+
await view.showResults(fromLog, toLog, {
1227+
kind: "local-run",
1228+
fromQuery: from.getQueryName(),
1229+
toQuery: to.getQueryName(),
1230+
});
12271231
}
12281232

12291233
function addUnhandledRejectionListener() {

0 commit comments

Comments
 (0)