Skip to content

Commit

Permalink
Adds 2 additional metrics
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Tevnan <jason.tevnan@gmail.com>
  • Loading branch information
tnosaj committed Oct 5, 2023
1 parent ef0543f commit 7534f23
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pkg/exporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.",
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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"),
Expand Down

0 comments on commit 7534f23

Please sign in to comment.