From 959724b47e9c428267e5ab1b1254ee1a302e713c Mon Sep 17 00:00:00 2001 From: Brian Olson Date: Fri, 29 Nov 2024 14:59:04 -0500 Subject: [PATCH] fix did memcached metrics --- plc/memcached.go | 4 ++-- plc/metrics.go | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/plc/memcached.go b/plc/memcached.go index 09b883dc1..50b0e2925 100644 --- a/plc/memcached.go +++ b/plc/memcached.go @@ -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) diff --git a/plc/metrics.go b/plc/metrics.go index 3a2521bd9..ea2af2022 100644 --- a/plc/metrics.go +++ b/plc/metrics.go @@ -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", +})