Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,22 @@ overview omits its drill-down footer in this format.
trace-engine-cli overview trace.json.gz --format json | jq '.mainThreadBreakdown.scriptingMs'
```

### Check thresholds in CI

`jq -e` exits with code 1 when the result is `false` or `null`. Use it to fail a CI job when a metric is over a threshold:

```bash
# Fail if LCP is over 2.5 s or CLS is over 0.1
trace-engine-cli overview trace.json.gz --format json \
| jq -e '(.coreWebVitals.lcp.valueMs // infinite) <= 2500 and (.coreWebVitals.cls.value // infinite) <= 0.1'

# Fail if a Core Web Vital has a poor rating
trace-engine-cli overview trace.json.gz --format json \
| jq -e '[.coreWebVitals[].rating] | all(. != "poor")'
```

A metric that the trace does not contain is `null`. In jq, `null <= 2500` is `true`, so `// infinite` makes the first check fail when the metric is missing.

---

## Bundling Local DevTools Trace Engine
Expand Down