Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds 2 additional metrics #184

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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