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
93 lines (80 loc) · 3.61 KB
/
config.go
File metadata and controls
93 lines (80 loc) · 3.61 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package querier
import (
"flag"
"time"
"github.com/grafana/dskit/backoff"
"github.com/grafana/dskit/grpcclient"
"github.com/grafana/tempo/modules/querier/worker"
)
// Config for a querier.
type Config struct {
Search SearchConfig `yaml:"search"`
TraceByID TraceByIDConfig `yaml:"trace_by_id"`
Metrics MetricsConfig `yaml:"metrics"`
PartitionRing PartitionRingConfig `yaml:"partition_ring"`
ExtraQueryDelay time.Duration `yaml:"extra_query_delay,omitempty"`
MaxConcurrentQueries int `yaml:"max_concurrent_queries"`
Worker worker.Config `yaml:"frontend_worker"`
ShuffleShardingIngestersEnabled bool `yaml:"shuffle_sharding_ingesters_enabled"`
ShuffleShardingIngestersLookbackPeriod time.Duration `yaml:"shuffle_sharding_ingesters_lookback_period"`
QueryRelevantIngesters bool `yaml:"query_relevant_ingesters"`
SecondaryIngesterRing string `yaml:"secondary_ingester_ring,omitempty"`
}
type SearchConfig struct {
QueryTimeout time.Duration `yaml:"query_timeout"`
}
type TraceByIDConfig struct {
QueryTimeout time.Duration `yaml:"query_timeout"`
External ExternalConfig `yaml:"external"`
}
type MetricsConfig struct {
ConcurrentBlocks int `yaml:"concurrent_blocks,omitempty"`
// TimeOverlapCutoff is a tuning factor that controls whether the trace-level
// timestamp columns are used in a metrics query. Loading these columns has a cost,
// so in some cases it faster to skip these columns entirely, reducing I/O but
// increasing the number of spans evalulated and thrown away. The value is a ratio
// between 0.0 and 1.0. If a block overlaps the time window by less than this value,
// then we skip the columns. A value of 1.0 will always load the columns, and 0.0 never.
TimeOverlapCutoff float64 `yaml:"time_overlap_cutoff,omitempty"`
}
type PartitionRingConfig struct {
MinimizeRequests bool `yaml:"minimize_requests"`
MinimizeRequestsHedgingDelay time.Duration `yaml:"hedging_delay"`
PreferredZone string `yaml:"preferred_zone,omitempty"`
}
type ExternalConfig struct {
Endpoint string `yaml:"endpoint"` // e.g., "http://external-service:3200"
Timeout time.Duration `yaml:"timeout"`
}
// RegisterFlagsAndApplyDefaults register flags.
func (cfg *Config) RegisterFlagsAndApplyDefaults(prefix string, f *flag.FlagSet) {
cfg.TraceByID.QueryTimeout = 10 * time.Second
cfg.TraceByID.External.Timeout = 10 * time.Second
cfg.QueryRelevantIngesters = false
cfg.ExtraQueryDelay = 0
cfg.MaxConcurrentQueries = 20
cfg.Search.QueryTimeout = 30 * time.Second
cfg.Metrics.ConcurrentBlocks = 2
cfg.Metrics.TimeOverlapCutoff = 0.2
cfg.Worker = worker.Config{
MatchMaxConcurrency: true,
MaxConcurrentRequests: cfg.MaxConcurrentQueries,
Parallelism: 2,
GRPCClientConfig: grpcclient.Config{
MaxRecvMsgSize: 100 << 20,
MaxSendMsgSize: 16 << 20,
GRPCCompression: "snappy",
BackoffConfig: backoff.Config{ // the max possible backoff should be lesser than QueryTimeout, with room for actual query response time
MinBackoff: 100 * time.Millisecond,
MaxBackoff: 1 * time.Second,
MaxRetries: 5,
},
},
DNSLookupPeriod: 10 * time.Second,
}
cfg.ShuffleShardingIngestersLookbackPeriod = 1 * time.Hour
cfg.PartitionRing.MinimizeRequests = true
cfg.PartitionRing.MinimizeRequestsHedgingDelay = 3 * time.Second
cfg.PartitionRing.PreferredZone = ""
f.StringVar(&cfg.Worker.FrontendAddress, prefix+".frontend-address", "", "Address of query frontend service, in host:port format.")
}