Commit Graph
1 Commits
Author SHA1 Message Date
lukaszraczylo 7e0d1e19b1 fix(circuitbreaker): guard nil monitoring to prevent boot panic
Starting with ENABLE_CIRCUIT_BREAKER=true panicked at boot: parseConfig -> initCircuitBreaker registers a metrics gauge, but cfg.Monitoring is assigned later by StartMonitoringServer, so the registration dereferenced a nil *MetricsSetup.

Add nil-receiver guards to the MetricsSetup registration methods (RegisterMetricsGauge/GaugeFunc/Counter, RegisterFloatCounter, RegisterMetricsSummary/Histogram), matching their existing 'return a dummy to prevent panics' contract. The guard is a no-op for non-nil receivers, so existing callers are unaffected. The breaker and the admin dashboard (which reads gobreaker state directly) keep working.

Add regression tests for the nil-receiver methods and for initCircuitBreaker with nil monitoring.
2026-06-21 02:48:37 +01:00