fix(trace): cpu_percent is omitted when no CPU was sampled

The replay UI already declared it optional, so a web run's steps recording a
zero per step were the only thing claiming a reading.
This commit is contained in:
pj committed 2026-08-22 21:41:40 +05:30
1 parent 1fb910e0a2
commit 28402bda7b
4 files changed
+14 -7

No files matched your search

+5 -3
View File
@@ -104,9 +104,11 @@ type ExtractorChange struct {
}
type Metrics struct {
CPUPercent float64 `json:"cpu_percent"`
HeapBytes int64 `json:"heap_bytes,omitempty"`
TotalMemoryBytes int64 `json:"total_memory_bytes,omitempty"`
// CPUPercent is omitted when the driver samples no CPU, so a web run's
// steps do not each record a zero the sampler never took.
CPUPercent *float64 `json:"cpu_percent,omitempty"`
HeapBytes int64 `json:"heap_bytes,omitempty"`
TotalMemoryBytes int64 `json:"total_memory_bytes,omitempty"`
}
// The three producers an action can come from. The spec's setup drives the app