From 7534f232e9b9015c56e1d65404641638134dfc34 Mon Sep 17 00:00:00 2001 From: Jason Tevnan Date: Thu, 5 Oct 2023 09:31:04 +0200 Subject: [PATCH] Adds 2 additional metrics Signed-off-by: Jason Tevnan --- pkg/exporter/exporter.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/pkg/exporter/exporter.go b/pkg/exporter/exporter.go index c31e5d7..4cdea26 100644 --- a/pkg/exporter/exporter.go +++ b/pkg/exporter/exporter.go @@ -63,6 +63,8 @@ type Exporter struct { itemsTotal *prometheus.Desc evictions *prometheus.Desc reclaimed *prometheus.Desc + itemStoreTooLarge *prometheus.Desc + itemStoreNoMemory *prometheus.Desc lruCrawlerEnabled *prometheus.Desc lruCrawlerSleep *prometheus.Desc lruCrawlerMaxItems *prometheus.Desc @@ -263,6 +265,18 @@ func New(server string, timeout time.Duration, logger log.Logger, tlsConfig *tls nil, nil, ), + itemStoreTooLarge: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, "", "item_too_large"), + "The number of times an item exceeded the max-item-size when being stored.", + nil, + nil, + ), + itemStoreNoMemory: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, "", "item_no_memory"), + "The number of times an item could not be stored due to no more memory.", + nil, + nil, + ), lruCrawlerEnabled: prometheus.NewDesc( prometheus.BuildFQName(Namespace, subsystemLruCrawler, "enabled"), "Whether the LRU crawler is enabled.", @@ -680,6 +694,8 @@ func (e *Exporter) Describe(ch chan<- *prometheus.Desc) { ch <- e.itemsTotal ch <- e.evictions ch <- e.reclaimed + ch <- e.itemStoreTooLarge + ch <- e.itemStoreNoMemory ch <- e.lruCrawlerEnabled ch <- e.lruCrawlerSleep ch <- e.lruCrawlerMaxItems @@ -793,6 +809,8 @@ func (e *Exporter) parseStats(ch chan<- prometheus.Metric, stats map[net.Addr]me "expired_unfetched": e.itemsExpiredUnfetched, "outofmemory": e.itemsOutofmemory, "reclaimed": e.itemsReclaimed, + "store_too_large": e.itemStoreTooLarge, + "store_no_memory": e.itemStoreNoMemory, "tailrepairs": e.itemsTailrepairs, "mem_requested": e.slabsMemRequested, "moves_to_cold": e.itemsMovesToCold, @@ -892,6 +910,8 @@ func (e *Exporter) parseStats(ch chan<- prometheus.Metric, stats map[net.Addr]me e.parseAndNewMetric(ch, e.listenerDisabledTotal, prometheus.CounterValue, s, "listen_disabled_num"), e.parseAndNewMetric(ch, e.evictions, prometheus.CounterValue, s, "evictions"), e.parseAndNewMetric(ch, e.reclaimed, prometheus.CounterValue, s, "reclaimed"), + 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.lruCrawlerItemsChecked, prometheus.CounterValue, s, "crawler_items_checked"), e.parseAndNewMetric(ch, e.lruCrawlerReclaimed, prometheus.CounterValue, s, "crawler_reclaimed"),