20667: Add at_quota metric.
authorTom Clegg <tom@curii.com>
Mon, 26 Jun 2023 15:17:48 +0000 (11:17 -0400)
committerTom Clegg <tom@curii.com>
Mon, 26 Jun 2023 15:17:48 +0000 (11:17 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

lib/dispatchcloud/scheduler/scheduler.go

index b1f8ea222329e981334739af30e12bbb1edf7d44..0a5a94c96cb9b4dc59b64a26255c065b5b8a8fc2 100644 (file)
@@ -122,6 +122,18 @@ func (sch *Scheduler) registerMetrics(reg *prometheus.Registry) {
                Help:      "Dynamically assigned limit on number of containers scheduled concurrency, set after receiving 503 errors from API.",
        })
        reg.MustRegister(sch.mMaxContainerConcurrency)
+       reg.MustRegister(prometheus.NewGaugeFunc(prometheus.GaugeOpts{
+               Namespace: "arvados",
+               Subsystem: "dispatchcloud",
+               Name:      "at_quota",
+               Help:      "Flag indicating the cloud driver is reporting an at-quota condition.",
+       }, func() float64 {
+               if sch.pool.AtQuota() {
+                       return 1
+               } else {
+                       return 0
+               }
+       }))
 }
 
 func (sch *Scheduler) updateMetrics() {