/
configs.go
85 lines (74 loc) · 2.73 KB
/
configs.go
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
package repository
import "time"
// MainSection describes Main section in combaine.yaml
type MainSection struct {
ClusterConfig ClusterConfig `yaml:"Cluster"`
ParallelParsings int `yaml:"ParallelParsings"`
// distribute aggregations across a "cluster", or make them "local"ly
DistributeAggregation string `yaml:"DistributeAggregation"`
// Duration of iteration in sec
// Pasring stage longs at least 0.8 * MinimumPeriod
IterationDuration uint `yaml:"MINIMUM_PERIOD"`
// Groups of cloud machines
CloudGroups []string `yaml:"cloud"`
// combaine cloud hosts fetcher
HostFetcher PluginConfig `yaml:"HostFetcher,omitempty"`
// Cache TTLCache options
Cache CacheConfig `yaml:"cache,omitempty"`
}
// CacheConfig for TTLCache
type CacheConfig struct {
TTL int64 `yaml:"ttl"`
Interval int64 `yaml:"interval"`
}
// ClusterConfig about serf and raft
type ClusterConfig struct {
BindAddr string `yaml:"BindAddr"`
RaftPort int `yaml:"RaftPort"`
// expect N serf nodes to bootstrap raft cluster
BootstrapExpect uint `yaml:"BootstrapExpect"`
StartAsLeader bool `yaml:"StartAsLeader"`
RaftUpdateInterval time.Duration `yaml:"RaftUpdateInterval"`
}
// CloudSection configure fetchers and discovery
type CloudSection struct {
// Default DataFetcher
DataFetcher PluginConfig `yaml:"DataFetcher"`
HostFetcher PluginConfig `yaml:"HostFetcher"`
}
// CombainerSection about combainer daemon configs
type CombainerSection struct {
MainSection `yaml:"Main"`
}
// CombainerConfig container for all other configs
type CombainerConfig struct {
CombainerSection `yaml:"Combainer"`
CloudSection `yaml:"cloud_config"`
}
// AggregationConfig represent aggregation section from combainer client config
type AggregationConfig struct {
// Configuration of data handlers (aka parsers)
Data map[string]PluginConfig `yaml:"data"`
// Configuration of possible senders
Senders map[string]PluginConfig `yaml:"senders"`
}
// ParsingConfig contains settings from parsing section of combainer configs
type ParsingConfig struct {
// List of host groups
Groups []string `yaml:"groups"`
// List of names of Aggregation configs
AggConfigs []string `yaml:"agg_configs"`
// Overrides the same section in combainer.yaml
DataFetcher PluginConfig `yaml:"DataFetcher,omitempty"`
// Overrides name of host group
Metahost string `yaml:"metahost" codec:"metahost"`
// MainSection contains server configs
MainSection `yaml:"Combainer"`
// Overrides the same section in combainer.yaml
HostFetcher PluginConfig `yaml:"HostFetcher,omitempty"`
}
// PluginConfig general description
// of any user-defined plugin configuration section
type PluginConfig map[string]interface{}
// EncodedConfig is the bytes of the configs readed
type EncodedConfig []byte