Addressing comments from #11154 after it was merged
pull/11213/head
Salva Corts 2 years ago committed by GitHub
parent 4248825ad2
commit 54edb2143f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      pkg/bloomcompactor/bloomcompactor.go
  2. 20
      pkg/bloomcompactor/job.go
  3. 4
      pkg/bloomcompactor/metrics.go

@ -197,7 +197,7 @@ func (c *Compactor) running(ctx context.Context) error {
case <-ticker.C:
c.metrics.compactionRunsStarted.Inc()
if err := c.runCompaction(ctx); err != nil {
c.metrics.compactionRunsErred.Inc()
c.metrics.compactionRunsFailed.Inc()
level.Error(c.logger).Log("msg", "failed to run compaction", "err", err)
continue
}

@ -13,8 +13,8 @@ type Job struct {
seriesFP model.Fingerprint
chunks []index.ChunkMeta
// We compute them lazily.
from, through *model.Time
// We compute them lazily. Unset value is 0.
from, through model.Time
}
// NewJob returns a new compaction Job.
@ -65,20 +65,24 @@ func (j *Job) IndexPath() string {
}
func (j *Job) From() model.Time {
if j.from == nil {
if j.from == 0 {
j.computeFromThrough()
}
return *j.from
return j.from
}
func (j *Job) Through() model.Time {
if j.through == nil {
if j.through == 0 {
j.computeFromThrough()
}
return *j.through
return j.through
}
func (j *Job) computeFromThrough() {
if len(j.chunks) == 0 {
return
}
minFrom := model.Latest
maxThrough := model.Earliest
@ -92,6 +96,6 @@ func (j *Job) computeFromThrough() {
}
}
j.from = &minFrom
j.through = &maxThrough
j.from = minFrom
j.through = maxThrough
}

@ -13,7 +13,7 @@ const (
type metrics struct {
compactionRunsStarted prometheus.Counter
compactionRunsCompleted prometheus.Counter
compactionRunsErred prometheus.Counter
compactionRunsFailed prometheus.Counter
compactionRunDiscoveredTenants prometheus.Counter
compactionRunSkippedTenants prometheus.Counter
compactionRunSucceededTenants prometheus.Counter
@ -39,7 +39,7 @@ func newMetrics(r prometheus.Registerer) *metrics {
Name: "runs_completed_total",
Help: "Total number of compactions completed successfully",
}),
compactionRunsErred: promauto.With(r).NewCounter(prometheus.CounterOpts{
compactionRunsFailed: promauto.With(r).NewCounter(prometheus.CounterOpts{
Namespace: metricsNamespace,
Subsystem: metricsSubsystem,
Name: "runs_failed_total",

Loading…
Cancel
Save