Send metrics to Graphite
This page covers the standalone Browsertime CLI. If you run sitespeed.io, use the built-in Graphite integration instead — it ships dashboards and a lot more configuration.
The easiest way to send metrics from Browsertime is to install jq and use it to pick the values you want to track. jq helps you pick data from a JSON file.
First you just run Browsertime. Here make sure we create the browsertime.json in a directory called tmp.
docker run --shm-size=1g --rm -v "$(pwd)":/browsertime-results sitespeedio/browsertime:27.2.0 --video --visualMetrics --resultDir tmp https://www.sitespeed.io/ -n 5 Then we pickup the median SpeedIndex from Browsertime and send it to your Graphite instance.
echo "browsertime.your.key.SpeedIndex.median" $(cat tmp/browsertime.json | jq .statistics.visualMetrics.SpeedIndex.median) "`date +%s`" | nc -q0 my.graphite.com 2003 browsertime.your.key.SpeedIndex.median is the start of the key that we send to Graphite and jq .statistics.visualMetrics.SpeedIndex.median make sure we pick the median value of the 5 runs we did. And nc (netcat) sends the data to your Graphite server.