Skip to content

Commit c724577

Browse files
committed
Store pipeline hash on PipelineSummary
1 parent 570f63e commit c724577

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

extensions/ql-vscode/src/log-insights/performance-comparison.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
import { createHash } from "crypto";
12
import type { EvaluationLogScanner } from "./log-scanner";
23
import type { SummaryEvent } from "./log-summary";
34

45
export interface PipelineSummary {
56
steps: string[];
67
/** Total counts for each step in the RA array, across all iterations */
78
counts: number[];
9+
hash: string;
810
}
911

1012
/**
@@ -188,6 +190,7 @@ export class PerformanceOverviewScanner implements EvaluationLogScanner {
188190
const pipelineSummary = (pipelineSummaries[raReference] ??= {
189191
steps: event.ra[raReference],
190192
counts: counts.map(() => 0),
193+
hash: getPipelineHash(event.ra[raReference]),
191194
});
192195
const { counts: totalTuplesPerStep } = pipelineSummary;
193196
for (let i = 0, length = counts.length; i < length; ++i) {
@@ -232,3 +235,11 @@ export class PerformanceOverviewScanner implements EvaluationLogScanner {
232235

233236
onDone(): void {}
234237
}
238+
239+
function getPipelineHash(steps: string[]) {
240+
const md5 = createHash("md5");
241+
for (const step of steps) {
242+
md5.write(step);
243+
}
244+
return md5.digest("base64");
245+
}

0 commit comments

Comments
 (0)