Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Keep fixture logs out of mock lookup benchmark results

rcourtmancb4ee313ffd7
diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
index 5e5ab57846..289c7111b9 100644
--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -4099,6 +4099,11 @@ hosts or PBS instances it throws away (see "Mock-mode metrics-target lookups
ride the fixture structure revision" in the monitoring contract for the callers
and the measurements).
+The mock lookup benchmark keeps the fixture logger quiet through setup,
+calibration and cleanup, then restores it. Untimed fixture logs otherwise split
+Go's result line and leave benchstat without that sample. The measured lookup
+work and reported lookup count stay unchanged.
+
### Update evidence reuses the bounded node observation
Package evidence adds only one bounded status, one bounded reason, and the
diff --git a/internal/monitoring/metrics_target_resolution_test.go b/internal/monitoring/metrics_target_resolution_test.go
index 79122e93ee..978f0409ca 100644
--- a/internal/monitoring/metrics_target_resolution_test.go
+++ b/internal/monitoring/metrics_target_resolution_test.go
@@ -7,6 +7,8 @@ import (
"github.com/rcourtman/pulse-go-rewrite/internal/mock"
"github.com/rcourtman/pulse-go-rewrite/internal/models"
"github.com/rcourtman/pulse-go-rewrite/internal/unifiedresources"
+ "github.com/rs/zerolog"
+ "github.com/rs/zerolog/log"
)
// useMockEstate enables the default mock estate with the given node count,
@@ -91,6 +93,12 @@ func resourceIDsWithTargets(tb testing.TB, view monitorUnifiedStateView) []strin
// a pass costs microseconds however slowly the process runs, not an estate
// build per lookup.
func BenchmarkMockMetricsTargetResolutionAfterTick(b *testing.B) {
+ // Fixture lifecycle logs would split the benchmark's result line during
+ // calibration. Keep setup and cleanup inside the same quiet logger scope.
+ originalLogger := log.Logger
+ log.Logger = zerolog.Nop()
+ b.Cleanup(func() { log.Logger = originalLogger })
+
useMockEstate(b, mock.DefaultConfig.NodeCount, time.Second)
m := newMockEstateMonitor()
ids := resourceIDsWithTargets(b, m.currentUnifiedStateView())