diff --git a/README.md b/README.md index dd3c86f..4bd6b12 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,8 @@ The exporter collects a number of statistics from the server: # TYPE memcached_current_connections gauge # HELP memcached_current_items Current number of items stored by this instance. # TYPE memcached_current_items gauge +# HELP memcached_direct_reclaims_total Times worker threads had to directly reclaim or evict items. +# TYPE memcached_direct_reclaims_total counter # HELP memcached_items_evicted_total Total number of valid items removed from cache to free memory for new items. # TYPE memcached_items_evicted_total counter # HELP memcached_items_reclaimed_total Total number of times an entry was stored using memory from an expired entry. diff --git a/pkg/exporter/exporter.go b/pkg/exporter/exporter.go index 2e2ce65..a5e5477 100644 --- a/pkg/exporter/exporter.go +++ b/pkg/exporter/exporter.go @@ -78,6 +78,7 @@ type Exporter struct { lruCrawlerMovesToCold *prometheus.Desc lruCrawlerMovesToWarm *prometheus.Desc lruCrawlerMovesWithinLru *prometheus.Desc + directReclaims *prometheus.Desc malloced *prometheus.Desc itemsNumber *prometheus.Desc itemsAge *prometheus.Desc @@ -276,6 +277,12 @@ func New(server string, timeout time.Duration, logger *slog.Logger, tlsConfig *t nil, nil, ), + directReclaims: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, "", "direct_reclaims_total"), + "Times worker threads had to directly reclaim or evict items.", + nil, + nil, + ), lruCrawlerEnabled: prometheus.NewDesc( prometheus.BuildFQName(Namespace, subsystemLruCrawler, "enabled"), "Whether the LRU crawler is enabled.", @@ -704,6 +711,7 @@ func (e *Exporter) Describe(ch chan<- *prometheus.Desc) { ch <- e.lruHotMaxAgeFactor ch <- e.lruWarmMaxAgeFactor ch <- e.lruCrawlerStarts + ch <- e.directReclaims ch <- e.lruCrawlerReclaimed ch <- e.lruCrawlerItemsChecked ch <- e.lruCrawlerMovesToCold @@ -912,6 +920,7 @@ func (e *Exporter) parseStats(ch chan<- prometheus.Metric, stats map[net.Addr]me e.parseAndNewMetric(ch, e.itemStoreTooLarge, prometheus.CounterValue, s, "store_too_large"), e.parseAndNewMetric(ch, e.itemStoreNoMemory, prometheus.CounterValue, s, "store_no_memory"), e.parseAndNewMetric(ch, e.lruCrawlerStarts, prometheus.CounterValue, s, "lru_crawler_starts"), + e.parseAndNewMetric(ch, e.directReclaims, prometheus.CounterValue, s, "direct_reclaims"), e.parseAndNewMetric(ch, e.lruCrawlerItemsChecked, prometheus.CounterValue, s, "crawler_items_checked"), e.parseAndNewMetric(ch, e.lruCrawlerReclaimed, prometheus.CounterValue, s, "crawler_reclaimed"), e.parseAndNewMetric(ch, e.lruCrawlerMovesToCold, prometheus.CounterValue, s, "moves_to_cold"),