mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-03 11:37:09 +00:00
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:
1 parent
1fb910e0a2
commit
28402bda7b
4 files changed
+14
-7
No files matched your search
@@ -1702,7 +1702,7 @@ func captureMetrics(ctx context.Context, options Options, logger *slog.Logger, s
|
||||
logger.Warn("metrics capture failed", "step", stepIndex, "err", err)
|
||||
return nil, true
|
||||
}
|
||||
if sample.CPUPercent == 0 && sample.HeapBytes == 0 && sample.TotalMemoryBytes == 0 {
|
||||
if sample.CPUPercent == nil && sample.HeapBytes == 0 && sample.TotalMemoryBytes == 0 {
|
||||
return nil, true
|
||||
}
|
||||
return &trace.Metrics{
|
||||
|
||||
@@ -1525,7 +1525,10 @@ func readTraceLines(t *testing.T, directory string) []traceStepLine {
|
||||
|
||||
func TestRunner_ParallelFetchCallsAllDriverMethods(t *testing.T) {
|
||||
state := newHarness(t)
|
||||
state.mock.MetricsData = driver.Metrics{CPUPercent: 5.0, HeapBytes: 1024, TotalMemoryBytes: 4096}
|
||||
cpuPercent := 5.0
|
||||
state.mock.MetricsData = driver.Metrics{
|
||||
CPUPercent: &cpuPercent, HeapBytes: 1024, TotalMemoryBytes: 4096,
|
||||
}
|
||||
state.mock.LogEntries = []driver.LogEntry{
|
||||
{UnixMillis: 1000, Level: "E", Tag: "test", Message: "boom"},
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user