Skip to content

Commit 5e6fe71

Browse files
authored
Delete prefix blocks_meta for meta fetcher metrics (#6832)
Signed-off-by: SungJin1212 <[email protected]>
1 parent fbc197f commit 5e6fe71

File tree

3 files changed

+50
-55
lines changed

3 files changed

+50
-55
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
* [BUGFIX] Fix race condition in active user. #6773
6060
* [BUGFIX] Ruler: Prevent counting 2xx and 4XX responses as failed writes. #6785
6161
* [BUGFIX] Ingester: Allow shipper to skip corrupted blocks. #6786
62+
* [BUGFIX] Compactor: Delete the prefix `blocks_meta` from the metadata fetcher metrics. #6832
6263

6364
## 1.19.0 2025-02-27
6465

pkg/compactor/compactor_metrics.go

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -75,44 +75,38 @@ func newCompactorMetricsWithLabels(reg prometheus.Registerer, commonLabels []str
7575

7676
// Copied from Thanos, pkg/block/fetcher.go
7777
m.baseFetcherSyncs = promauto.With(reg).NewCounterVec(prometheus.CounterOpts{
78-
Subsystem: block.FetcherSubSys,
79-
Name: "cortex_compactor_meta_base_syncs_total",
80-
Help: "Total blocks metadata synchronization attempts by base Fetcher.",
78+
Name: "cortex_compactor_meta_base_syncs_total",
79+
Help: "Total blocks metadata synchronization attempts by base Fetcher.",
8180
}, nil)
8281

8382
// Copied from Thanos, pkg/block/fetcher.go
8483
m.metaFetcherSyncs = promauto.With(reg).NewCounterVec(prometheus.CounterOpts{
85-
Subsystem: block.FetcherSubSys,
86-
Name: "cortex_compactor_meta_syncs_total",
87-
Help: "Total blocks metadata synchronization attempts.",
84+
Name: "cortex_compactor_meta_syncs_total",
85+
Help: "Total blocks metadata synchronization attempts.",
8886
}, nil)
8987
m.metaFetcherSyncFailures = promauto.With(reg).NewCounterVec(prometheus.CounterOpts{
90-
Subsystem: block.FetcherSubSys,
91-
Name: "cortex_compactor_meta_sync_failures_total",
92-
Help: "Total blocks metadata synchronization failures.",
88+
Name: "cortex_compactor_meta_sync_failures_total",
89+
Help: "Total blocks metadata synchronization failures.",
9390
}, nil)
9491
m.metaFetcherSyncDuration = promauto.With(reg).NewHistogramVec(prometheus.HistogramOpts{
95-
Subsystem: block.FetcherSubSys,
96-
Name: "cortex_compactor_meta_sync_duration_seconds",
97-
Help: "Duration of the blocks metadata synchronization in seconds.",
98-
Buckets: []float64{0.01, 1, 10, 100, 300, 600, 1000},
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},
9995
}, nil)
10096
m.metaFetcherSynced = extprom.NewTxGaugeVec(
10197
reg,
10298
prometheus.GaugeOpts{
103-
Subsystem: block.FetcherSubSys,
104-
Name: "cortex_compactor_meta_synced",
105-
Help: "Number of block metadata synced",
99+
Name: "cortex_compactor_meta_synced",
100+
Help: "Number of block metadata synced",
106101
},
107102
[]string{"state"},
108103
block.DefaultSyncedStateLabelValues()...,
109104
)
110105
m.metaFetcherModified = extprom.NewTxGaugeVec(
111106
reg,
112107
prometheus.GaugeOpts{
113-
Subsystem: block.FetcherSubSys,
114-
Name: "cortex_compactor_meta_modified",
115-
Help: "Number of blocks whose metadata changed",
108+
Name: "cortex_compactor_meta_modified",
109+
Help: "Number of blocks whose metadata changed",
116110
},
117111
[]string{"modified"},
118112
block.DefaultModifiedLabelValues()...,

pkg/compactor/compactor_metrics_test.go

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -18,42 +18,42 @@ func TestCompactorMetrics(t *testing.T) {
1818
generateTestData(cm, 2222)
1919

2020
err := testutil.GatherAndCompare(reg, bytes.NewBufferString(`
21-
# HELP blocks_meta_cortex_compactor_meta_base_syncs_total Total blocks metadata synchronization attempts by base Fetcher.
22-
# TYPE blocks_meta_cortex_compactor_meta_base_syncs_total counter
23-
blocks_meta_cortex_compactor_meta_base_syncs_total 11110
24-
# HELP blocks_meta_cortex_compactor_meta_modified Number of blocks whose metadata changed
25-
# TYPE blocks_meta_cortex_compactor_meta_modified gauge
26-
blocks_meta_cortex_compactor_meta_modified{modified="replica-label-removed"} 0
27-
# HELP blocks_meta_cortex_compactor_meta_sync_duration_seconds Duration of the blocks metadata synchronization in seconds.
28-
# TYPE blocks_meta_cortex_compactor_meta_sync_duration_seconds histogram
29-
blocks_meta_cortex_compactor_meta_sync_duration_seconds_bucket{le="0.01"} 0
30-
blocks_meta_cortex_compactor_meta_sync_duration_seconds_bucket{le="1"} 2
31-
blocks_meta_cortex_compactor_meta_sync_duration_seconds_bucket{le="10"} 3
32-
blocks_meta_cortex_compactor_meta_sync_duration_seconds_bucket{le="100"} 3
33-
blocks_meta_cortex_compactor_meta_sync_duration_seconds_bucket{le="300"} 3
34-
blocks_meta_cortex_compactor_meta_sync_duration_seconds_bucket{le="600"} 3
35-
blocks_meta_cortex_compactor_meta_sync_duration_seconds_bucket{le="1000"} 3
36-
blocks_meta_cortex_compactor_meta_sync_duration_seconds_bucket{le="+Inf"} 3
37-
blocks_meta_cortex_compactor_meta_sync_duration_seconds_sum 4.444
38-
blocks_meta_cortex_compactor_meta_sync_duration_seconds_count 3
39-
# HELP blocks_meta_cortex_compactor_meta_sync_failures_total Total blocks metadata synchronization failures.
40-
# TYPE blocks_meta_cortex_compactor_meta_sync_failures_total counter
41-
blocks_meta_cortex_compactor_meta_sync_failures_total 33330
42-
# HELP blocks_meta_cortex_compactor_meta_synced Number of block metadata synced
43-
# TYPE blocks_meta_cortex_compactor_meta_synced gauge
44-
blocks_meta_cortex_compactor_meta_synced{state="corrupted-meta-json"} 0
45-
blocks_meta_cortex_compactor_meta_synced{state="duplicate"} 0
46-
blocks_meta_cortex_compactor_meta_synced{state="failed"} 0
47-
blocks_meta_cortex_compactor_meta_synced{state="label-excluded"} 0
48-
blocks_meta_cortex_compactor_meta_synced{state="loaded"} 0
49-
blocks_meta_cortex_compactor_meta_synced{state="marked-for-deletion"} 0
50-
blocks_meta_cortex_compactor_meta_synced{state="marked-for-no-compact"} 0
51-
blocks_meta_cortex_compactor_meta_synced{state="no-meta-json"} 0
52-
blocks_meta_cortex_compactor_meta_synced{state="time-excluded"} 0
53-
blocks_meta_cortex_compactor_meta_synced{state="too-fresh"} 0
54-
# HELP blocks_meta_cortex_compactor_meta_syncs_total Total blocks metadata synchronization attempts.
55-
# TYPE blocks_meta_cortex_compactor_meta_syncs_total counter
56-
blocks_meta_cortex_compactor_meta_syncs_total 22220
21+
# HELP cortex_compactor_meta_base_syncs_total Total blocks metadata synchronization attempts by base Fetcher.
22+
# TYPE cortex_compactor_meta_base_syncs_total counter
23+
cortex_compactor_meta_base_syncs_total 11110
24+
# HELP cortex_compactor_meta_modified Number of blocks whose metadata changed
25+
# TYPE cortex_compactor_meta_modified gauge
26+
cortex_compactor_meta_modified{modified="replica-label-removed"} 0
27+
# HELP cortex_compactor_meta_sync_duration_seconds Duration of the blocks metadata synchronization in seconds.
28+
# TYPE cortex_compactor_meta_sync_duration_seconds histogram
29+
cortex_compactor_meta_sync_duration_seconds_bucket{le="0.01"} 0
30+
cortex_compactor_meta_sync_duration_seconds_bucket{le="1"} 2
31+
cortex_compactor_meta_sync_duration_seconds_bucket{le="10"} 3
32+
cortex_compactor_meta_sync_duration_seconds_bucket{le="100"} 3
33+
cortex_compactor_meta_sync_duration_seconds_bucket{le="300"} 3
34+
cortex_compactor_meta_sync_duration_seconds_bucket{le="600"} 3
35+
cortex_compactor_meta_sync_duration_seconds_bucket{le="1000"} 3
36+
cortex_compactor_meta_sync_duration_seconds_bucket{le="+Inf"} 3
37+
cortex_compactor_meta_sync_duration_seconds_sum 4.444
38+
cortex_compactor_meta_sync_duration_seconds_count 3
39+
# HELP cortex_compactor_meta_sync_failures_total Total blocks metadata synchronization failures.
40+
# TYPE cortex_compactor_meta_sync_failures_total counter
41+
cortex_compactor_meta_sync_failures_total 33330
42+
# HELP cortex_compactor_meta_synced Number of block metadata synced
43+
# TYPE cortex_compactor_meta_synced gauge
44+
cortex_compactor_meta_synced{state="corrupted-meta-json"} 0
45+
cortex_compactor_meta_synced{state="duplicate"} 0
46+
cortex_compactor_meta_synced{state="failed"} 0
47+
cortex_compactor_meta_synced{state="label-excluded"} 0
48+
cortex_compactor_meta_synced{state="loaded"} 0
49+
cortex_compactor_meta_synced{state="marked-for-deletion"} 0
50+
cortex_compactor_meta_synced{state="marked-for-no-compact"} 0
51+
cortex_compactor_meta_synced{state="no-meta-json"} 0
52+
cortex_compactor_meta_synced{state="time-excluded"} 0
53+
cortex_compactor_meta_synced{state="too-fresh"} 0
54+
# HELP cortex_compactor_meta_syncs_total Total blocks metadata synchronization attempts.
55+
# TYPE cortex_compactor_meta_syncs_total counter
56+
cortex_compactor_meta_syncs_total 22220
5757
# HELP cortex_compact_group_compaction_planned_total Total number of compaction planned.
5858
# TYPE cortex_compact_group_compaction_planned_total counter
5959
cortex_compact_group_compaction_planned_total{user="aaa"} 211090

0 commit comments

Comments
 (0)