Skip to content

Commit

Permalink
Fixed memcached client metrics initialization (#2446)
Browse files Browse the repository at this point in the history
Signed-off-by: Marco Pracucci <marco@pracucci.com>
  • Loading branch information
pracucci committed Apr 16, 2020
1 parent c77d7ca commit b391ca1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/cacheutil/memcached_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,25 +217,33 @@ func newMemcachedClient(
Help: "Total number of operations against memcached.",
ConstLabels: prometheus.Labels{"name": name},
}, []string{"operation"})
c.operations.WithLabelValues(opGetMulti)
c.operations.WithLabelValues(opSet)

c.failures = promauto.With(reg).NewCounterVec(prometheus.CounterOpts{
Name: "thanos_memcached_operation_failures_total",
Help: "Total number of operations against memcached that failed.",
ConstLabels: prometheus.Labels{"name": name},
}, []string{"operation"})
c.failures.WithLabelValues(opGetMulti)
c.failures.WithLabelValues(opSet)

c.skipped = promauto.With(reg).NewCounterVec(prometheus.CounterOpts{
Name: "thanos_memcached_operation_skipped_total",
Help: "Total number of operations against memcached that have been skipped.",
ConstLabels: prometheus.Labels{"name": name},
}, []string{"operation", "reason"})
c.skipped.WithLabelValues(opGetMulti, reasonMaxItemSize)
c.skipped.WithLabelValues(opSet, reasonMaxItemSize)

c.duration = promauto.With(reg).NewHistogramVec(prometheus.HistogramOpts{
Name: "thanos_memcached_operation_duration_seconds",
Help: "Duration of operations against memcached.",
ConstLabels: prometheus.Labels{"name": name},
Buckets: []float64{0.001, 0.005, 0.01, 0.025, 0.05, 0.1, 0.2, 0.5, 1},
}, []string{"operation"})
c.duration.WithLabelValues(opGetMulti)
c.duration.WithLabelValues(opSet)

// As soon as the client is created it must ensure that memcached server
// addresses are resolved, so we're going to trigger an initial addresses
Expand Down

0 comments on commit b391ca1

Please sign in to comment.