UI: add gzip compression to files and fix symbolize-ui-crash
- Turns out that we were compressing html/js/css files only
in transit (-j) and not at rest (-z) when uploading the UI.
This has two drawbacks:
1. (minor) The storage cost if higher.
2. (major) When the browser makes an Accept-Encoding: gzip request
the GCS backend does NOT honor that and sends the file uncompressed.
The right thing to do is to use -z which compresses at rest.
This works both with HTTP clients that support Accept-Encoding: gzip,
and ones that don't (GCS will transparently decompress for them).
- Add compression also to map files, that benefit the most of compression.
- Fix the tools/symbolize-ui-crash to deal with recent changes to the
crash reporter.
Change-Id: I7ac4396b791440a10bd22638c5464952f5fcd2e2
diff --git a/tools/symbolize-ui-crash b/tools/symbolize-ui-crash
index 8da6bf3..b6747b4 100755
--- a/tools/symbolize-ui-crash
+++ b/tools/symbolize-ui-crash
@@ -71,14 +71,23 @@
# Look for the GIT commitish appended in crash reports. This is not required
# for resolving the sourcemaps but helps generating better links.
- matches = re.findall(r'([a-f0-9]{40})\sUA', txt)
- git_rev = matches[0] if matches else 'HEAD'
+ matches = re.findall(r'https://ui.perfetto.dev/(.*-)([a-f0-9]{6,})\n', txt)
+ if not matches:
+ logging.fatal('Could not determine the version.'
+ 'The crash report should have a line like: '
+ '"UI: https://ui.perfetto.dev/v12.3-abcdef"')
+ return 1
- matches = re.findall(r'((\bhttp.+?\.js):(\d+):(\d+))', txt)
+ dir_name = matches[0][0] + matches[0][1]
+ git_rev = matches[0][1]
+ base_url = 'https://commondatastorage.googleapis.com/ui.perfetto.dev/' + dir_name + '/'
+ matches = re.findall(r'(\((.+[.]js):(\d+):(\d+)\))', txt)
maps_by_url = {}
sym_lines = ''
for entry in matches:
whole_token, script_url, line, col = entry
+ if '/' not in script_url:
+ script_url = base_url + script_url
map_url = script_url + '.map'
if map_url in maps_by_url:
srcmap = maps_by_url[map_url]
diff --git a/ui/release/build_all_channels.py b/ui/release/build_all_channels.py
index 4a61e5e..9aa9c33 100755
--- a/ui/release/build_all_channels.py
+++ b/ui/release/build_all_channels.py
@@ -128,8 +128,8 @@
print('Uploading to gs://%s' % BUCKET_NAME)
print('===================================================================')
cp_cmd = [
- 'gsutil', '-m', '-h', 'Cache-Control:public, max-age=3600', 'cp', '-j',
- 'html,js,css,wasm'
+ 'gsutil', '-m', '-h', 'Cache-Control:public, max-age=3600', 'cp', '-z',
+ 'html,js,css,wasm,map'
]
for name in os.listdir(merged_dist_dir):
path = pjoin(merged_dist_dir, name)