Skip to content

Instantly share code, notes, and snippets.

Created October 7, 2020 22:05
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Extract connection information from the WebPageTest API and format as a CSV
#!/usr/bin/env jq -rMf
# Filter to extract DNS, Connect, SSL metrics from WebPageTest run JSON
# Headers for resulting CSV
["DNS", "Connect", "SSL"],
# drill down into the runs data
# convert the run data into an object and drill down into the run request data
| to_entries[].value.firstView.requests[]
# only select the request that corresponds to the HTML page (so it has DNS,Connect,SSL data)
| select(.final_base_page == true)
# build an array of the resulting data we want in the CSV
| [(.dns_end - .dns_start), (.connect_end - .connect_start), (.ssl_end - .ssl_start)]
# pass to the CSV formatter
| @csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment