Skip to content

Commit

Permalink
reused blocks instrumentation
Browse files Browse the repository at this point in the history
Signed-off-by: Owen Diehl <[email protected]>
  • Loading branch information
owen-d committed Feb 20, 2024
1 parent d025d91 commit 66d8465
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/bloomcompactor/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -436,6 +437,8 @@ func (s *SimpleBloomController) buildGaps(

created = append(created, meta)
totalSeries += uint64(seriesItrWithCounter.Count())

s.metrics.blocksReused.Add(float64(len(gap.blocks)))
}
}

Expand Down
8 changes: 8 additions & 0 deletions pkg/bloomcompactor/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 66d8465

Please sign in to comment.