Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
lighthouse(event.target, flags).then(function(results) {
// Increment the lighthouse counter
metrics.increment('lighthouse.invoke')
// Get total page load time metric
// push metric to datadog, ref: https://github.com/dbader/node-datadog-metrics#gauges
metrics.gauge("total", results.timing.total)
// Get the Lighthouse score for the website
// ref: https://developers.google.com/web/tools/lighthouse/scoring
metrics.gauge("score", results.score)
// Parse report blob to extract performance metrics
results.reportCategories.filter(function(v){
return v["id"] == "performance"
})[0].audits.filter(function(v){
return v["group"] == "perf-metric"
}).forEach(function(chunk){
const increment = (key, value=1, tags, timestamp=Date.now()) => {
metrics.increment(key, value, tags || [], timestamp)
}