diff --git a/pkg/bloomcompactor/controller.go b/pkg/bloomcompactor/controller.go index 2a4ff6cd45242..2d0f84a7a4055 100644 --- a/pkg/bloomcompactor/controller.go +++ b/pkg/bloomcompactor/controller.go @@ -346,6 +346,7 @@ func (s *SimpleBloomController) buildGaps( // Fetch blocks that aren't up to date but are in the desired fingerprint range // to try and accelerate bloom creation + level.Debug(logger).Log("msg", "loading series and blocks for gap", "blocks", len(gap.blocks)) seriesItr, blocksIter, err := s.loadWorkForGap(ctx, table, tenant, plan.tsdb, gap) if err != nil { level.Error(logger).Log("msg", "failed to get series and blocks", "err", err) @@ -436,6 +437,8 @@ func (s *SimpleBloomController) buildGaps( created = append(created, meta) totalSeries += uint64(seriesItrWithCounter.Count()) + + s.metrics.blocksReused.Add(float64(len(gap.blocks))) } } diff --git a/pkg/bloomcompactor/metrics.go b/pkg/bloomcompactor/metrics.go index 74378cb786429..9f844f0e40f73 100644 --- a/pkg/bloomcompactor/metrics.go +++ b/pkg/bloomcompactor/metrics.go @@ -32,6 +32,8 @@ type Metrics struct { tenantsCompletedTime *prometheus.HistogramVec tenantsSeries prometheus.Histogram + blocksReused prometheus.Counter + blocksCreated prometheus.Counter blocksDeleted prometheus.Counter metasCreated prometheus.Counter @@ -120,6 +122,12 @@ func NewMetrics(r prometheus.Registerer, bloomMetrics *v1.Metrics) *Metrics { // Up to 10M series per tenant, way more than what we expect given our max_global_streams_per_user limits Buckets: prometheus.ExponentialBucketsRange(1, 10000000, 10), }), + blocksReused: promauto.With(r).NewCounter(prometheus.CounterOpts{ + Namespace: metricsNamespace, + Subsystem: metricsSubsystem, + Name: "blocks_reused_total", + Help: "Number of overlapping bloom blocks reused when creating new blocks", + }), blocksCreated: promauto.With(r).NewCounter(prometheus.CounterOpts{ Namespace: metricsNamespace, Subsystem: metricsSubsystem,