add a pending approvals prometheus metric

pull/477/head
Stefan Schwarz 2020-02-06 07:44:58 +01:00
parent 127a820268
commit 13dc40cf39
1 changed files with 10 additions and 0 deletions

View File

@ -13,6 +13,7 @@ import (
"github.com/keel-hq/keel/pkg/store"
"github.com/keel-hq/keel/types"
"github.com/prometheus/client_golang/prometheus"
log "github.com/sirupsen/logrus"
)
@ -90,6 +91,15 @@ func New(opts *Opts) *DefaultManager {
subMu: &sync.RWMutex{},
}
prom_pending := prometheus.NewGaugeFunc(prometheus.GaugeOpts{
Name: "keel_pending_approvals",
Help: "number of the pending approvals",
}, func() float64 {
approvals, _ := man.List()
return float64(len(approvals))
})
prometheus.MustRegister(prom_pending)
return man
}