Skip to content

Commit

Permalink
fix(store/cache): unstick cache metrics names (#3857)
Browse files Browse the repository at this point in the history
  • Loading branch information
walldiss authored Oct 20, 2024
1 parent 36fb8c2 commit b4b89fc
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions store/cache/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cache

import (
"context"
"fmt"

"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/metric"
Expand All @@ -19,21 +20,21 @@ type metrics struct {
}

func newMetrics(bc *AccessorCache) (*metrics, error) {
metricsPrefix := "eds_cache" + bc.name
metricsPrefix := fmt.Sprintf("eds_cache_%p_", bc)

evictedCounter, err := meter.Int64Counter(metricsPrefix+"_evicted_counter",
evictedCounter, err := meter.Int64Counter(metricsPrefix+"evicted_counter",
metric.WithDescription("eds cache evicted event counter"))
if err != nil {
return nil, err
}

getCounter, err := meter.Int64Counter(metricsPrefix+"_get_counter",
getCounter, err := meter.Int64Counter(metricsPrefix+"get_counter",
metric.WithDescription("eds cache get event counter"))
if err != nil {
return nil, err
}

cacheSize, err := meter.Int64ObservableGauge(metricsPrefix+"_size",
cacheSize, err := meter.Int64ObservableGauge(metricsPrefix+"size",
metric.WithDescription("total amount of items in cache"),
)
if err != nil {
Expand Down

0 comments on commit b4b89fc

Please sign in to comment.