Skip to content

Commit c8f0553

Browse files
committed
feat: send description to compare performance view
1 parent 85f043b commit c8f0553

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
readonly comparison: boolean;

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { withProgress } from "../common/vscode/progress";
1717
import { telemetryListener } from "../common/vscode/telemetry";
1818
import type { ResultsView } from "../local-queries";
1919
import { scanLog } from "../log-insights/log-scanner";
20+
import type { ComparePerformanceDescriptionData } from "../log-insights/performance-comparison";
2021
import { PerformanceOverviewScanner } from "../log-insights/performance-comparison";
2122
import type { HistoryItemLabelProvider } from "../query-history/history-item-label-provider";
2223
import { RemoteLogs } from "./remote-logs";
@@ -45,7 +46,11 @@ export class ComparePerformanceView extends AbstractWebview<
4546
);
4647
}
4748

48-
async showResults(fromJsonLog: string, toJsonLog: string) {
49+
async showResults(
50+
fromJsonLog: string,
51+
toJsonLog: string,
52+
description: ComparePerformanceDescriptionData,
53+
) {
4954
const panel = await this.getPanel();
5055
panel.reveal(undefined, false);
5156

@@ -79,6 +84,7 @@ export class ComparePerformanceView extends AbstractWebview<
7984

8085
await this.postMessage({
8186
t: "setPerformanceComparison",
87+
description,
8288
from: fromPerf.getData(),
8389
to: toPerf.getData(),
8490
comparison: fromJsonLog !== "",
@@ -140,6 +146,6 @@ export class ComparePerformanceView extends AbstractWebview<
140146
);
141147
return;
142148
}
143-
await this.showResults(result.before, result.after);
149+
await this.showResults(result.before, result.after, result.description);
144150
}
145151
}

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
@@ -1228,7 +1228,11 @@ async function showPerformanceComparison(
12281228
`Comparing performance of ${from.getQueryName()} and ${to?.getQueryName() ?? "baseline"}`,
12291229
);
12301230

1231-
await view.showResults(fromLog, toLog);
1231+
await view.showResults(fromLog, toLog, {
1232+
kind: "local-run",
1233+
fromQuery: from.getQueryName(),
1234+
toQuery: to.getQueryName(),
1235+
});
12321236
}
12331237

12341238
function addUnhandledRejectionListener() {

0 commit comments

Comments
 (0)