Skip to content

Commit 1089a05

Browse files
author
Dave Bartolomeo
committed
Initial implementation of join order metric scanning
1 parent 1d195cb commit 1089a05

12 files changed

Lines changed: 883 additions & 7 deletions

File tree

extensions/ql-vscode/package-lock.json

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extensions/ql-vscode/package.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -746,11 +746,6 @@
746746
"group": "9_qlCommands",
747747
"when": "codeql.supportsEvalLog && viewItem == rawResultsItem || codeql.supportsEvalLog && viewItem == interpretedResultsItem || codeql.supportsEvalLog && viewItem == cancelledResultsItem"
748748
},
749-
{
750-
"command": "codeQLQueryHistory.scanEvalLog",
751-
"group": "9_qlCommands",
752-
"when": "codeql.supportsEvalLog && (viewItem == rawResultsItem || viewItem == interpretedResultsItem || viewItem == cancelledResultsItem)"
753-
},
754749
{
755750
"command": "codeQLQueryHistory.showQueryText",
756751
"group": "9_qlCommands",

extensions/ql-vscode/src/cli.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,23 @@ export class CodeQLCliServer implements Disposable {
685685
return await this.runCodeQlCliCommand(['generate', 'log-summary'], subcommandArgs, 'Generating log summary');
686686
}
687687

688+
/**
689+
* Generate a JSON summary of an evaluation log.
690+
* @param inputPath The path of an evaluation event log.
691+
* @param outputPath The path to write a JSON summary of it to.
692+
*/
693+
async generateJsonLogSummary(
694+
inputPath: string,
695+
outputPath: string
696+
): Promise<string> {
697+
const subcommandArgs = [
698+
'--minify-output',
699+
inputPath,
700+
outputPath
701+
];
702+
return await this.runCodeQlCliCommand(['generate', 'log-summary'], subcommandArgs, 'Generating log summary');
703+
}
704+
688705
/**
689706
* Gets the results from a bqrs.
690707
* @param bqrsPath The path to the bqrs.

extensions/ql-vscode/src/extension.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ import { URLSearchParams } from 'url';
9797
import { handleDownloadPacks, handleInstallPackDependencies } from './packaging';
9898
import { RemoteQueryHistoryItem } from './remote-queries/remote-query-history-item';
9999
import { HistoryItemLabelProvider } from './history-item-label-provider';
100+
import { JoinOrderScannerProvider } from './log-insights/join-order';
100101

101102
/**
102103
* extension.ts
@@ -470,6 +471,9 @@ async function activateWithInstalledDistribution(
470471

471472
ctx.subscriptions.push(qhm);
472473

474+
void logger.log('Initializing evaluation log scanners.');
475+
ctx.subscriptions.push(qhm.registerLogScannerProvider(new JoinOrderScannerProvider()));
476+
473477
void logger.log('Initializing results panel interface.');
474478
const intm = new InterfaceManager(ctx, dbm, cliServer, queryServerLogger, labelProvider);
475479
ctx.subscriptions.push(intm);
@@ -504,6 +508,8 @@ async function activateWithInstalledDistribution(
504508
forceReveal: WebviewReveal
505509
): Promise<void> {
506510
await intm.showResults(query, forceReveal, false);
511+
// Always update the log warnings so they stay in sync with the results.
512+
await qhm.scanEvalLog(query);
507513
}
508514

509515
async function compileAndRunQuery(

0 commit comments

Comments
 (0)