Skip to content

Commit 5563e2b

Browse files
committed
rename var names
1 parent ea48b6d commit 5563e2b

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

pkg/compactor/blocks_cleaner.go

+21-21
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,18 @@ type BlocksCleaner struct {
4545
lastOwnedUsers []string
4646

4747
// Metrics.
48-
runsStarted prometheus.Counter
49-
runsCompleted prometheus.Counter
50-
runsFailed prometheus.Counter
51-
runsLastSuccess prometheus.Gauge
52-
blocksCleanedTotal prometheus.Counter
53-
blocksFailedTotal prometheus.Counter
54-
blocksMarkedForDeletion prometheus.Counter
55-
tenantBlocks *prometheus.GaugeVec
56-
tenantMarkedBlocks *prometheus.GaugeVec
57-
tenantPartialBlocks *prometheus.GaugeVec
58-
tenantBucketIndexLastUpdate *prometheus.GaugeVec
59-
tenantMarkedNoCompactBlocks *prometheus.GaugeVec
48+
runsStarted prometheus.Counter
49+
runsCompleted prometheus.Counter
50+
runsFailed prometheus.Counter
51+
runsLastSuccess prometheus.Gauge
52+
blocksCleanedTotal prometheus.Counter
53+
blocksFailedTotal prometheus.Counter
54+
blocksMarkedForDeletion prometheus.Counter
55+
tenantBlocks *prometheus.GaugeVec
56+
tenantBlocksMarkedForDelete *prometheus.GaugeVec
57+
tenantBlocksMarkedForNoCompaction *prometheus.GaugeVec
58+
tenantPartialBlocks *prometheus.GaugeVec
59+
tenantBucketIndexLastUpdate *prometheus.GaugeVec
6060
}
6161

6262
func NewBlocksCleaner(cfg BlocksCleanerConfig, bucketClient objstore.Bucket, usersScanner *cortex_tsdb.UsersScanner, cfgProvider ConfigProvider, logger log.Logger, reg prometheus.Registerer) *BlocksCleaner {
@@ -103,11 +103,11 @@ func NewBlocksCleaner(cfg BlocksCleanerConfig, bucketClient objstore.Bucket, use
103103
Name: "cortex_bucket_blocks_count",
104104
Help: "Total number of blocks in the bucket. Includes blocks marked for deletion, but not partial blocks.",
105105
}, []string{"user"}),
106-
tenantMarkedBlocks: promauto.With(reg).NewGaugeVec(prometheus.GaugeOpts{
106+
tenantBlocksMarkedForDelete: promauto.With(reg).NewGaugeVec(prometheus.GaugeOpts{
107107
Name: "cortex_bucket_blocks_marked_for_deletion_count",
108108
Help: "Total number of blocks marked for deletion in the bucket.",
109109
}, []string{"user"}),
110-
tenantMarkedNoCompactBlocks: promauto.With(reg).NewGaugeVec(prometheus.GaugeOpts{
110+
tenantBlocksMarkedForNoCompaction: promauto.With(reg).NewGaugeVec(prometheus.GaugeOpts{
111111
Name: "cortex_bucket_blocks_marked_for_no_compaction_count",
112112
Help: "Total number of blocks marked for no compaction in the bucket.",
113113
}, []string{"user"}),
@@ -173,8 +173,8 @@ func (c *BlocksCleaner) cleanUsers(ctx context.Context, firstRun bool) error {
173173
for _, userID := range c.lastOwnedUsers {
174174
if !isActive[userID] && !isDeleted[userID] {
175175
c.tenantBlocks.DeleteLabelValues(userID)
176-
c.tenantMarkedBlocks.DeleteLabelValues(userID)
177-
c.tenantMarkedNoCompactBlocks.DeleteLabelValues(userID)
176+
c.tenantBlocksMarkedForDelete.DeleteLabelValues(userID)
177+
c.tenantBlocksMarkedForNoCompaction.DeleteLabelValues(userID)
178178
c.tenantPartialBlocks.DeleteLabelValues(userID)
179179
c.tenantBucketIndexLastUpdate.DeleteLabelValues(userID)
180180
}
@@ -237,16 +237,16 @@ func (c *BlocksCleaner) deleteUserMarkedForDeletion(ctx context.Context, userID
237237
// to delete. We also consider them all marked for deletion given the next run will try
238238
// to delete them again.
239239
c.tenantBlocks.WithLabelValues(userID).Set(float64(failed))
240-
c.tenantMarkedBlocks.WithLabelValues(userID).Set(float64(failed))
240+
c.tenantBlocksMarkedForDelete.WithLabelValues(userID).Set(float64(failed))
241241
c.tenantPartialBlocks.WithLabelValues(userID).Set(0)
242242

243243
return errors.Errorf("failed to delete %d blocks", failed)
244244
}
245245

246246
// Given all blocks have been deleted, we can also remove the metrics.
247247
c.tenantBlocks.DeleteLabelValues(userID)
248-
c.tenantMarkedBlocks.DeleteLabelValues(userID)
249-
c.tenantMarkedNoCompactBlocks.DeleteLabelValues(userID)
248+
c.tenantBlocksMarkedForDelete.DeleteLabelValues(userID)
249+
c.tenantBlocksMarkedForNoCompaction.DeleteLabelValues(userID)
250250
c.tenantPartialBlocks.DeleteLabelValues(userID)
251251

252252
if deletedBlocks > 0 {
@@ -338,7 +338,6 @@ func (c *BlocksCleaner) cleanUser(ctx context.Context, userID string, firstRun b
338338
// Generate an updated in-memory version of the bucket index.
339339
w := bucketindex.NewUpdater(c.bucketClient, userID, c.cfgProvider, c.logger)
340340
idx, partials, totalBlocksBlocksMarkedForNoCompaction, err := w.UpdateIndex(ctx, idx)
341-
c.tenantMarkedNoCompactBlocks.WithLabelValues(userID).Set(float64(totalBlocksBlocksMarkedForNoCompaction))
342341
if err != nil {
343342
return err
344343
}
@@ -375,7 +374,8 @@ func (c *BlocksCleaner) cleanUser(ctx context.Context, userID string, firstRun b
375374
}
376375

377376
c.tenantBlocks.WithLabelValues(userID).Set(float64(len(idx.Blocks)))
378-
c.tenantMarkedBlocks.WithLabelValues(userID).Set(float64(len(idx.BlockDeletionMarks)))
377+
c.tenantBlocksMarkedForDelete.WithLabelValues(userID).Set(float64(len(idx.BlockDeletionMarks)))
378+
c.tenantBlocksMarkedForNoCompaction.WithLabelValues(userID).Set(float64(totalBlocksBlocksMarkedForNoCompaction))
379379
c.tenantBucketIndexLastUpdate.WithLabelValues(userID).SetToCurrentTime()
380380
c.tenantPartialBlocks.WithLabelValues(userID).Set(float64(len(partials)))
381381

0 commit comments

Comments
 (0)