MCPcopy Create free account
hub / github.com/cortexproject/cortex / NewPostingCacheMetrics

Function NewPostingCacheMetrics

pkg/storage/tsdb/expanded_postings_cache.go:47–70  ·  view source on GitHub ↗
(r prometheus.Registerer)

Source from the content-addressed store, hash-verified

45}
46
47func NewPostingCacheMetrics(r prometheus.Registerer) *ExpandedPostingsCacheMetrics {
48 return &ExpandedPostingsCacheMetrics{
49 CacheRequests: promauto.With(r).NewCounterVec(prometheus.CounterOpts{
50 Name: "cortex_ingester_expanded_postings_cache_requests_total",
51 Help: "Total number of requests to the cache.",
52 }, []string{"cache"}),
53 CacheHits: promauto.With(r).NewCounterVec(prometheus.CounterOpts{
54 Name: "cortex_ingester_expanded_postings_cache_hits_total",
55 Help: "Total number of hit requests to the cache.",
56 }, []string{"cache"}),
57 CacheMiss: promauto.With(r).NewCounterVec(prometheus.CounterOpts{
58 Name: "cortex_ingester_expanded_postings_cache_miss_total",
59 Help: "Total number of miss requests to the cache.",
60 }, []string{"cache", "reason"}),
61 CacheEvicts: promauto.With(r).NewCounterVec(prometheus.CounterOpts{
62 Name: "cortex_ingester_expanded_postings_cache_evicts_total",
63 Help: "Total number of evictions in the cache, excluding items that got evicted due to TTL.",
64 }, []string{"cache", "reason"}),
65 NonCacheableQueries: promauto.With(r).NewCounterVec(prometheus.CounterOpts{
66 Name: "cortex_ingester_expanded_postings_non_cacheable_queries_total",
67 Help: "Total number of non cacheable queries.",
68 }, []string{"cache"}),
69 }
70}
71
72type TSDBPostingsCacheConfig struct {
73 Head PostingsCacheConfig `yaml:"head" doc:"description=If enabled, ingesters will cache expanded postings for the head block. Only queries with with an equal matcher for metric __name__ are cached."`

Callers 5

newIngesterMetricsFunction · 0.92
TestFifoCacheDisabledFunction · 0.85
TestFifoCacheExpireFunction · 0.85

Calls

no outgoing calls

Tested by 4

TestFifoCacheDisabledFunction · 0.68
TestFifoCacheExpireFunction · 0.68