forked from grafana/tempo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.go
More file actions
37 lines (31 loc) · 1.7 KB
/
config.go
File metadata and controls
37 lines (31 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package compactor
import (
"flag"
"time"
cortex_compactor "github.com/cortexproject/cortex/pkg/compactor"
"github.com/cortexproject/cortex/pkg/ring"
"github.com/cortexproject/cortex/pkg/util/flagext"
"github.com/grafana/tempo/pkg/util"
"github.com/grafana/tempo/tempodb"
)
type Config struct {
ShardingRing cortex_compactor.RingConfig `yaml:"ring,omitempty"`
Compactor tempodb.CompactorConfig `yaml:"compaction"`
OverrideRingKey string `yaml:"override_ring_key"`
}
// RegisterFlagsAndApplyDefaults registers the flags.
func (cfg *Config) RegisterFlagsAndApplyDefaults(prefix string, f *flag.FlagSet) {
cfg.Compactor = tempodb.CompactorConfig{
ChunkSizeBytes: 10 * 1024 * 1024, // 10 MiB
FlushSizeBytes: 30 * 1024 * 1024, // 30 MiB
CompactedBlockRetention: time.Hour,
RetentionConcurrency: tempodb.DefaultRetentionConcurrency,
}
flagext.DefaultValues(&cfg.ShardingRing)
cfg.ShardingRing.KVStore.Store = "" // by default compactor is not sharded
f.DurationVar(&cfg.Compactor.BlockRetention, util.PrefixConfig(prefix, "compaction.block-retention"), 14*24*time.Hour, "Duration to keep blocks/traces.")
f.IntVar(&cfg.Compactor.MaxCompactionObjects, util.PrefixConfig(prefix, "compaction.max-objects-per-block"), 6000000, "Maximum number of traces in a compacted block.")
f.Uint64Var(&cfg.Compactor.MaxBlockBytes, util.PrefixConfig(prefix, "compaction.max-block-bytes"), 100*1024*1024*1024 /* 100GB */, "Maximum size of a compacted block.")
f.DurationVar(&cfg.Compactor.MaxCompactionRange, util.PrefixConfig(prefix, "compaction.compaction-window"), 4*time.Hour, "Maximum time window across which to compact blocks.")
cfg.OverrideRingKey = ring.CompactorRingKey
}