MCPcopy
hub / github.com/grafana/tempo / EnableCompaction

Method EnableCompaction

tempodb/tempodb.go:585–613  ·  view source on GitHub ↗

EnableCompaction activates the compaction/retention loops

(ctx context.Context, cfg *CompactorConfig, c CompactorSharder, overrides CompactorOverrides)

Source from the content-addressed store, hash-verified

583
584// EnableCompaction activates the compaction/retention loops
585func (rw *readerWriter) EnableCompaction(ctx context.Context, cfg *CompactorConfig, c CompactorSharder, overrides CompactorOverrides) error {
586 // If compactor configuration is not as expected, no need to go any further
587 err := cfg.validate()
588 if err != nil {
589 return err
590 }
591
592 // Set default if needed. This is mainly for tests.
593 if cfg.RetentionConcurrency == 0 {
594 cfg.RetentionConcurrency = DefaultRetentionConcurrency
595 }
596
597 rw.compactorCfg = cfg
598 rw.compactorSharder = c
599 rw.compactorOverrides = overrides
600
601 if rw.cfg.BlocklistPoll == 0 {
602 level.Info(rw.logger).Log("msg", "polling cycle unset. compaction and retention disabled")
603 return nil
604 }
605
606 if cfg != nil {
607 level.Info(rw.logger).Log("msg", "compaction and retention enabled.")
608 go rw.compactionLoop(ctx)
609 go rw.retentionLoop(ctx)
610 }
611
612 return nil
613}
614
615func (rw *readerWriter) MarkBlockCompacted(tenantID string, blockID backend.UUID) error {
616 return rw.c.MarkBlockCompacted((uuid.UUID)(blockID), tenantID)

Callers

nothing calls this directly

Calls 4

compactionLoopMethod · 0.95
retentionLoopMethod · 0.95
validateMethod · 0.65
LogMethod · 0.65

Tested by

no test coverage detected