Skip to content

Commit

Permalink
fix did memcached metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
brianolson committed Nov 29, 2024
1 parent 766b840 commit 959724b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plc/memcached.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ func (r *MemcachedDidResolver) GetDocument(ctx context.Context, didstr string) (
doc, ok := r.tryCache(didstr)
if ok {
span.SetAttributes(attribute.Bool("cache", true))
cacheHitsTotal.Inc()
memcacheHitsTotal.Inc()
return doc, nil
}
cacheMissesTotal.Inc()
memcacheMissesTotal.Inc()
span.SetAttributes(attribute.Bool("cache", false))

doc, err := r.res.GetDocument(ctx, didstr)
Expand Down
10 changes: 10 additions & 0 deletions plc/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,13 @@ var cacheMissesTotal = promauto.NewCounter(prometheus.CounterOpts{
Name: "plc_cache_misses_total",
Help: "Total number of cache misses",
})

var memcacheHitsTotal = promauto.NewCounter(prometheus.CounterOpts{
Name: "plc_memcache_hits_total",
Help: "Total number of cache hits",
})

var memcacheMissesTotal = promauto.NewCounter(prometheus.CounterOpts{
Name: "plc_memcache_misses_total",
Help: "Total number of cache misses",
})

0 comments on commit 959724b

Please sign in to comment.