November improvements. (#29)

* Tackling the CPU / memory spikes after some time.

* Update admin dashboard, fix the circuit breaker and request coalescing.
This commit is contained in:
2025-11-29 14:21:09 +00:00
committed by GitHub
parent b210627fb7
commit 6a69694ab3
9 changed files with 633 additions and 61 deletions
+6 -10
View File
@@ -23,18 +23,14 @@ func NewCircuitBreakerMetrics(monitoring *libpack_monitoring.MetricsSetup) *Circ
// Initialize state value
cbm.stateValue.Store(float64(0))
// Create gauge with callback that reads the atomic value
cbm.stateGauge = monitoring.RegisterMetricsGauge(
// Create gauge with callback that reads the atomic value on every scrape
// This ensures the metric always reflects the current circuit breaker state
cbm.stateGauge = monitoring.RegisterMetricsGaugeFunc(
libpack_monitoring.MetricsCircuitState,
nil,
0, // Initial value doesn't matter as callback will be used
)
// Override the gauge callback to read from atomic value
cbm.stateGauge = monitoring.RegisterMetricsGauge(
libpack_monitoring.MetricsCircuitState,
nil,
cbm.GetState(),
func() float64 {
return cbm.GetState()
},
)
return cbm