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

Function newCompactorMetricsWithLabels

pkg/compactor/compactor_metrics.go:70–183  ·  view source on GitHub ↗
(reg prometheus.Registerer, commonLabels []string, compactionLabels []string)

Source from the content-addressed store, hash-verified

68}
69
70func newCompactorMetricsWithLabels(reg prometheus.Registerer, commonLabels []string, compactionLabels []string) *compactorMetrics {
71 var m compactorMetrics
72 m.reg = reg
73 m.commonLabels = commonLabels
74 m.compactionLabels = compactionLabels
75
76 // Copied from Thanos, pkg/block/fetcher.go
77 m.baseFetcherSyncs = promauto.With(reg).NewCounterVec(prometheus.CounterOpts{
78 Name: "cortex_compactor_meta_base_syncs_total",
79 Help: "Total blocks metadata synchronization attempts by base Fetcher.",
80 }, nil)
81
82 // Copied from Thanos, pkg/block/fetcher.go
83 m.metaFetcherSyncs = promauto.With(reg).NewCounterVec(prometheus.CounterOpts{
84 Name: "cortex_compactor_meta_syncs_total",
85 Help: "Total blocks metadata synchronization attempts.",
86 }, nil)
87 m.metaFetcherSyncFailures = promauto.With(reg).NewCounterVec(prometheus.CounterOpts{
88 Name: "cortex_compactor_meta_sync_failures_total",
89 Help: "Total blocks metadata synchronization failures.",
90 }, nil)
91 m.metaFetcherSyncDuration = promauto.With(reg).NewHistogramVec(prometheus.HistogramOpts{
92 Name: "cortex_compactor_meta_sync_duration_seconds",
93 Help: "Duration of the blocks metadata synchronization in seconds.",
94 Buckets: []float64{0.01, 1, 10, 100, 300, 600, 1000},
95 }, nil)
96 m.metaFetcherSynced = extprom.NewTxGaugeVec(
97 reg,
98 prometheus.GaugeOpts{
99 Name: "cortex_compactor_meta_synced",
100 Help: "Number of block metadata synced",
101 },
102 []string{"state"},
103 block.DefaultSyncedStateLabelValues()...,
104 )
105 m.metaFetcherModified = extprom.NewTxGaugeVec(
106 reg,
107 prometheus.GaugeOpts{
108 Name: "cortex_compactor_meta_modified",
109 Help: "Number of blocks whose metadata changed",
110 },
111 []string{"modified"},
112 block.DefaultModifiedLabelValues()...,
113 )
114
115 // Copied from Thanos, pkg/compact/compact.go.
116 m.syncerGarbageCollectedBlocks = promauto.With(reg).NewCounterVec(prometheus.CounterOpts{
117 Name: "cortex_compactor_garbage_collected_blocks_total",
118 Help: "Total number of blocks marked for deletion by compactor.",
119 }, nil)
120 m.syncerGarbageCollections = promauto.With(reg).NewCounterVec(prometheus.CounterOpts{
121 Name: "cortex_compactor_garbage_collection_total",
122 Help: "Total number of garbage collection operations.",
123 }, nil)
124 m.syncerGarbageCollectionFailures = promauto.With(reg).NewCounterVec(prometheus.CounterOpts{
125 Name: "cortex_compactor_garbage_collection_failures_total",
126 Help: "Total number of failed garbage collection operations.",
127 }, nil)

Callers 3

TestCompactorMetricsFunction · 0.85
newCompactorMetricsFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestCompactorMetricsFunction · 0.68