fix(driver): a CPU sample the driver never took is absent, not zero

CDP exposes no per-page CPU, so chrome's Metrics filled CPUPercent with a zero,
which is the same answer an idle app gives. Making the field optional is the
same fix as the iOS reads: absence is the only honest way to say nothing looked.
This commit is contained in:
pj committed 2026-08-22 21:41:40 +05:30
1 parent 577993b540
commit 1fb910e0a2
3 files changed
+8 -3

No files matched your search

+4 -1
View File
@@ -183,7 +183,10 @@ type Health struct {
}
type Metrics struct {
CPUPercent float64
// CPUPercent is nil on a driver that samples memory but not CPU, which
// Chrome does: zero is a reading an idle app can produce, so a driver that
// never looked has to answer with nothing rather than with that.
CPUPercent *float64
HeapBytes int64
TotalMemoryBytes int64
}