Encryption: Add Prometheus metrics (#48603)

This commit is contained in:
Joan López de la Franca Beltran
2022-05-06 10:21:55 +02:00
committed by GitHub
parent 0e1dffc655
commit 9826a694a8
8 changed files with 95 additions and 10 deletions
+8
View File
@@ -1,8 +1,11 @@
package manager
import (
"strconv"
"sync"
"time"
"github.com/prometheus/client_golang/prometheus"
)
var (
@@ -36,6 +39,11 @@ func (c *dataKeyCache) get(id string) ([]byte, bool) {
defer c.RUnlock()
entry, exists := c.entries[id]
cacheReadsCounter.With(prometheus.Labels{
"hit": strconv.FormatBool(exists),
}).Inc()
if !exists || entry.expired() {
return nil, false
}