diff --git a/entity_cache.go b/entity_cache.go index d8d209d..a70574a 100644 --- a/entity_cache.go +++ b/entity_cache.go @@ -40,18 +40,19 @@ func New( if err != nil { return nil, err } + pr := prometheus.NewCounterVec( + prometheus.CounterOpts{ + Name: promMetricName, + Help: "A counter of hit/miss on the entity cache.", + }, + []string{"namespace", "hit"}, + ) + prometheus.MustRegister(pr) return &EntityCache{ - promHitCounter: prometheus.NewCounterVec( - prometheus.CounterOpts{ - Name: promMetricName, - Help: "A counter of hit/miss on the entity cache.", - }, - []string{"namespace", "hit"}, - ), - - maxEntries: maxEntries, - ttr: ttr, - ttl: ttl, + promHitCounter: pr, + maxEntries: maxEntries, + ttr: ttr, + ttl: ttl, cache: cache, locker: locker.NewEntityLocker(), diff --git a/go.mod b/go.mod index 126b29a..49473ec 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/solher/entitycache +module github.com/justwatch/entitycache go 1.21.0 @@ -22,3 +22,5 @@ require ( golang.org/x/sys v0.8.0 // indirect google.golang.org/protobuf v1.30.0 // indirect ) + +replace github.com/solher/entitycache => github.com/justwatch/entitycache v0.0.0-20240229045341-55dfa11564a7