[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clients(lr): insert assets in lhr for logging purposes #9002

Merged
merged 6 commits into from
May 22, 2019

Conversation

connorjclark
Copy link
Collaborator

This enables logging from PSI.

Maybe we should log all the artifacts too?

Tests awaiting feedback.

Note: this PR is building on this (Googlers only).

@brendankenny
Copy link
Member

at some point we were going to delete all of this because the artifacts are returned by the module now. Can lr use that instead of this logging business?

@connorjclark
Copy link
Collaborator Author
connorjclark commented May 20, 2019

Discussed offline a bit.

We considered changing the LR entry to return the entire RunnerResult, but that would involve some annoying parsing changes in LR.

Realized we can just put all of the runnerResult.artifacts on the LR return value, without touching the asset saving module. I can revert all the changes there, unless it's better now?

Copy link
Member
@paulirish paulirish left a comment

Choose a reason for hiding this comment

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

Let's put up the LR-side of this for review as well?

It'd be easier to handle both at once.

*/
async function logAssets(artifacts, audits) {
Copy link
Member

Choose a reason for hiding this comment

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

once we have the LR-side to process your nested artifacts, I think we can delete this logAssets function.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done


if (logAssets) {
await assetSaver.logAssets(results.artifacts, results.lhr.audits);
const assetsToLog =
Copy link
Member

Choose a reason for hiding this comment

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

this refactor doesn't seem to be a win. if anything, logAssets() should call its own private prepare method, but due to other comments, i dont think we'll end up needing this code anyhow.

// When LR is called with |internal: {keep_raw_response: true, save_lighthouse_assets: true}|,
// this code will log artifacts to raw_response.artifacts.
if (logAssets) {
const reportObj = JSON.parse(runnerResult.report);
Copy link
Member

Choose a reason for hiding this comment

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

let's use runnerResult.lhr instead of parsing the string back

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.

None yet

3 participants