Initialize proxy prometheus counters values to 0 to prevent gaps after registry restart

Signed-off-by: Dimitar Kostadinov <dimitar.kostadinov@sap.com>
This commit is contained in:
Dimitar Kostadinov 2024-02-19 16:02:45 +02:00
parent 62aa44edfd
commit 6ca646caad

View file

@ -62,6 +62,16 @@ func init() {
})) }))
metrics.Register(prometheus.ProxyNamespace) metrics.Register(prometheus.ProxyNamespace)
initPrometheusMetrics("blob")
initPrometheusMetrics("manifest")
}
func initPrometheusMetrics(value string) {
requests.WithValues(value).Inc(0)
hits.WithValues(value).Inc(0)
misses.WithValues(value).Inc(0)
pulledBytes.WithValues(value).Inc(0)
pushedBytes.WithValues(value).Inc(0)
} }
// BlobPull tracks metrics about blobs pulled into the cache // BlobPull tracks metrics about blobs pulled into the cache