forked from grafana/tempo
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfig.go
More file actions
73 lines (61 loc) · 2.43 KB
/
config.go
File metadata and controls
73 lines (61 loc) · 2.43 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package tempodb
import (
"errors"
"fmt"
"time"
cortex_cache "github.com/cortexproject/cortex/pkg/chunk/cache"
"github.com/grafana/tempo/tempodb/backend/azure"
"github.com/grafana/tempo/tempodb/backend/cache/memcached"
"github.com/grafana/tempo/tempodb/backend/cache/redis"
"github.com/grafana/tempo/tempodb/backend/gcs"
"github.com/grafana/tempo/tempodb/backend/local"
"github.com/grafana/tempo/tempodb/backend/s3"
"github.com/grafana/tempo/tempodb/encoding"
"github.com/grafana/tempo/tempodb/pool"
"github.com/grafana/tempo/tempodb/wal"
)
const DefaultBlocklistPollConcurrency = uint(50)
const DefaultRetentionConcurrency = uint(10)
// Config holds the entirety of tempodb configuration
type Config struct {
Pool *pool.Config `yaml:"pool,omitempty"`
WAL *wal.Config `yaml:"wal"`
Block *encoding.BlockConfig `yaml:"block"`
BlocklistPoll time.Duration `yaml:"blocklist_poll"`
BlocklistPollConcurrency uint `yaml:"blocklist_poll_concurrency"`
// backends
Backend string `yaml:"backend"`
Local *local.Config `yaml:"local"`
GCS *gcs.Config `yaml:"gcs"`
S3 *s3.Config `yaml:"s3"`
Azure *azure.Config `yaml:"azure"`
// caches
Cache string `yaml:"cache"`
BackgroundCache *cortex_cache.BackgroundConfig `yaml:"background_cache"`
Memcached *memcached.Config `yaml:"memcached"`
Redis *redis.Config `yaml:"redis"`
}
// CompactorConfig contains compaction configuration options
type CompactorConfig struct {
ChunkSizeBytes uint32 `yaml:"chunk_size_bytes"` // todo: do we need this?
FlushSizeBytes uint32 `yaml:"flush_size_bytes"`
MaxCompactionRange time.Duration `yaml:"compaction_window"`
MaxCompactionObjects int `yaml:"max_compaction_objects"`
MaxBlockBytes uint64 `yaml:"max_block_bytes"`
BlockRetention time.Duration `yaml:"block_retention"`
CompactedBlockRetention time.Duration `yaml:"compacted_block_retention"`
RetentionConcurrency uint `yaml:"retention_concurrency"`
}
func validateConfig(cfg *Config) error {
if cfg.WAL == nil {
return errors.New("wal config should be non-nil")
}
if cfg.Block == nil {
return errors.New("block config should be non-nil")
}
err := encoding.ValidateConfig(cfg.Block)
if err != nil {
return fmt.Errorf("block config validation failed: %w", err)
}
return nil
}