Skip to content

Print end-of-query summary logs to Query Server Console#1264

Merged
angelapwen merged 9 commits intogithub:mainfrom
angelapwen:log-end-summary-file
Mar 31, 2022
Merged

Print end-of-query summary logs to Query Server Console#1264
angelapwen merged 9 commits intogithub:mainfrom
angelapwen:log-end-summary-file

Conversation

@angelapwen
Copy link
Copy Markdown
Contributor

@angelapwen angelapwen commented Mar 30, 2022

This change passes the --end-summary=$eoq-evaluator-log.jsonl.summary option to the CLI so that a separate file in the given location is written, with only the end-of-query summary information (most expensive predicate and timings). It then directly logs the contents of this file to the query server console.

It also changes the CLI version we gate all evaluator logs behind to 2.9.0 for simplicity. Otherwise, we would need to pass in one set of arguments to the CLI for 2.8.4 and another for 2.9.0. If in the future a user must be on a 2.8.x release and would like evaluator logs, we will be able to modify this for them easily.

This has been tested locally on VSCode (by modifying the CLI version expected to 2.8.3 and using the main checkout of the CLI) and works as we expect:
Screen Shot 2022-03-30 at 4 18 36 PM

Checklist

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.
  • [Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the ready-for-doc-review label there.

@angelapwen angelapwen requested a review from a team as a code owner March 30, 2022 23:20
}

export function findQueryEvalLogSummaryFile(resultPath: string): string {
return path.join(resultPath, 'evaluator-log.jsonl.summary');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a valid json or jsonl file? If so, it should probably use the proper file extension. Maybe:

Suggested change
return path.join(resultPath, 'evaluator-log.jsonl.summary');
return path.join(resultPath, 'evaluator-log.summary.jsonl');

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not — it's a generated text file summarizing the contents of the jsonl file.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK...then maybe avoid the jsonl component entirely?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems agreeable to me, I'll hold to see if @edoardopirovano who named the summary file originally has objections 😸

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just calling it .summary seems perfectly reasonable to me, yep!

}

export function findQueryEvalLogEndSummaryFile(resultPath: string): string {
return path.join(resultPath, 'eoq-evaluator-log.jsonl.summary');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also here:

Suggested change
return path.join(resultPath, 'eoq-evaluator-log.jsonl.summary');
return path.join(resultPath, 'eoq-evaluator-log.summary.jsonl');

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, it's not a JSONL file but rather a condensed version of the summary text file. I didn't know how to name it so appended eoq to the beginning of the file rather than at the end, but

evaluator-log.jsonl.summary.eoq might also work?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe evaluator-log-end.summary? As I understand it, this is only used internally so I don't suppose it matters too much.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this one now that the jsonl part is gone! Very succinct

if (err) {
throw new Error(`Could not read structured evaluator log end of summary file at ${this.evalLogEndSummaryPath}.`);
}
void qs.logger.log(' --- Evaluator Log Summary --- ', { additionalLogLocation: this.logPath });
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will add the ' --- Evaluator Log Summary --- ' to the file. Is this what we want? Is it better/possible to ensure the output is proper json or jsonl?

Copy link
Copy Markdown
Contributor Author

@angelapwen angelapwen Mar 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds the ' --- Evaluator Log Summary --- ' line to the Query Server Console, which I believe is what we want. The file itself (the end summary file) should never be read by a user; it's generated on the CLI side specifically for this use case.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The additionalLogLocation will add the contents to this.logPath. If it's not meant to be read by a user and it is not jsonl syntax then adding this line to it as well is fine.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, the user is meant to read this line (and the following lines) only from the Query Server Console. I can remove the additionalLogLocation part of the logging so that the user will not see traces of the evaluator structured logs in the additional log where they may not expect it. If they want the full summary of the structured log, they can view the actual summary file.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are much more familiar with this feature than I am. I am fine with it if you decide to leave this in.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think dropping the additionalLogLocation so it still shows in the Query Server Console but doesn't get logged elsewhere sounds reasonable to me. I see you've already done this in your new commit 👍🏼

Copy link
Copy Markdown
Contributor

@edoardopirovano edoardopirovano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, thanks! I'm happy with this at it is, modulo you may want some simpler names for the files as discussed above 🙂

@angelapwen angelapwen enabled auto-merge (squash) March 31, 2022 16:24
@angelapwen angelapwen merged commit cc1bf74 into github:main Mar 31, 2022
@angelapwen angelapwen deleted the log-end-summary-file branch March 31, 2022 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants