Skip to content

Commit 5dab939

Browse files
authored
Merge pull request #184 from tnosaj/jt/add-store_too_large-stat
Adds 2 additional metrics
2 parents b604907 + 7534f23 commit 5dab939

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

pkg/exporter/exporter.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ type Exporter struct {
6363
itemsTotal *prometheus.Desc
6464
evictions *prometheus.Desc
6565
reclaimed *prometheus.Desc
66+
itemStoreTooLarge *prometheus.Desc
67+
itemStoreNoMemory *prometheus.Desc
6668
lruCrawlerEnabled *prometheus.Desc
6769
lruCrawlerSleep *prometheus.Desc
6870
lruCrawlerMaxItems *prometheus.Desc
@@ -263,6 +265,18 @@ func New(server string, timeout time.Duration, logger log.Logger, tlsConfig *tls
263265
nil,
264266
nil,
265267
),
268+
itemStoreTooLarge: prometheus.NewDesc(
269+
prometheus.BuildFQName(Namespace, "", "item_too_large"),
270+
"The number of times an item exceeded the max-item-size when being stored.",
271+
nil,
272+
nil,
273+
),
274+
itemStoreNoMemory: prometheus.NewDesc(
275+
prometheus.BuildFQName(Namespace, "", "item_no_memory"),
276+
"The number of times an item could not be stored due to no more memory.",
277+
nil,
278+
nil,
279+
),
266280
lruCrawlerEnabled: prometheus.NewDesc(
267281
prometheus.BuildFQName(Namespace, subsystemLruCrawler, "enabled"),
268282
"Whether the LRU crawler is enabled.",
@@ -680,6 +694,8 @@ func (e *Exporter) Describe(ch chan<- *prometheus.Desc) {
680694
ch <- e.itemsTotal
681695
ch <- e.evictions
682696
ch <- e.reclaimed
697+
ch <- e.itemStoreTooLarge
698+
ch <- e.itemStoreNoMemory
683699
ch <- e.lruCrawlerEnabled
684700
ch <- e.lruCrawlerSleep
685701
ch <- e.lruCrawlerMaxItems
@@ -793,6 +809,8 @@ func (e *Exporter) parseStats(ch chan<- prometheus.Metric, stats map[net.Addr]me
793809
"expired_unfetched": e.itemsExpiredUnfetched,
794810
"outofmemory": e.itemsOutofmemory,
795811
"reclaimed": e.itemsReclaimed,
812+
"store_too_large": e.itemStoreTooLarge,
813+
"store_no_memory": e.itemStoreNoMemory,
796814
"tailrepairs": e.itemsTailrepairs,
797815
"mem_requested": e.slabsMemRequested,
798816
"moves_to_cold": e.itemsMovesToCold,
@@ -892,6 +910,8 @@ func (e *Exporter) parseStats(ch chan<- prometheus.Metric, stats map[net.Addr]me
892910
e.parseAndNewMetric(ch, e.listenerDisabledTotal, prometheus.CounterValue, s, "listen_disabled_num"),
893911
e.parseAndNewMetric(ch, e.evictions, prometheus.CounterValue, s, "evictions"),
894912
e.parseAndNewMetric(ch, e.reclaimed, prometheus.CounterValue, s, "reclaimed"),
913+
e.parseAndNewMetric(ch, e.itemStoreTooLarge, prometheus.CounterValue, s, "store_too_large"),
914+
e.parseAndNewMetric(ch, e.itemStoreNoMemory, prometheus.CounterValue, s, "store_no_memory"),
895915
e.parseAndNewMetric(ch, e.lruCrawlerStarts, prometheus.CounterValue, s, "lru_crawler_starts"),
896916
e.parseAndNewMetric(ch, e.lruCrawlerItemsChecked, prometheus.CounterValue, s, "crawler_items_checked"),
897917
e.parseAndNewMetric(ch, e.lruCrawlerReclaimed, prometheus.CounterValue, s, "crawler_reclaimed"),

0 commit comments

Comments
 (0)