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

Reduce size of Lighthouse payload #67

Open
rviscomi opened this issue Nov 8, 2018 · 2 comments
Open

Reduce size of Lighthouse payload #67

rviscomi opened this issue Nov 8, 2018 · 2 comments

Comments

@rviscomi
Copy link
Member

rviscomi commented Nov 8, 2018

The latest lighthouse.2018_10_15 table is 237 GB. Querying all lighthouse tables currently costs 4.15 TB and runs in several minutes.

image

  1. identify parts of the JSON payload that are unnecessary or unlikely to have analytical value and also significant contributors to the payload size
  2. modify the Dataflow pipeline to omit these parts of the payload
  3. profit
@connorjclark
Copy link

Can you point to where this trimming could be done?

@rviscomi
Copy link
Member Author

Hey @connorjclark the get_lighthouse_reports function in the Dataflow pipeline would be the place where we can trim off excess response data

def get_lighthouse_reports(har):
"""Parses Lighthouse results from a HAR object."""
if not har:
return
report = har.get('_lighthouse')
if not report:
return
page_url = get_page_url(har)
if not page_url:
logging.warning('Skipping lighthouse report: unable to get page URL (see preceding warning).')
return
# Omit large UGC.
report.get('audits').get('screenshot-thumbnails', {}).get('details', {}).pop('items', None)
try:
report_json = to_json(report)
except:
logging.warning('Skipping Lighthouse report for "%s": unable to stringify as JSON.' % page_url)
return
report_size = len(report_json)
if report_size > MAX_CONTENT_SIZE:
logging.warning('Skipping Lighthouse report for "%s": Report size (%s) exceeded maximum content size of %s bytes.' % (page_url, report_size, MAX_CONTENT_SIZE))
return
return [{
'url': page_url,
'report': report_json
}]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants