-
-
Notifications
You must be signed in to change notification settings - Fork 64
/
config.go
39 lines (34 loc) · 883 Bytes
/
config.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
package metrics
// Config contains metrics configuration
type Config struct {
Log bool
LogInterval int // Deprecated
RotateInterval int
LogFormatter string
// Print only specified metrics
LogFilter []string
HTTP string
Host string
Port int
Tags map[string]string
Statsd StatsdConfig
}
// NewConfig creates an empty Config struct
func NewConfig() Config {
return Config{
RotateInterval: 15,
Statsd: NewStatsdConfig(),
}
}
// LogEnabled returns true iff any log option is specified
func (c *Config) LogEnabled() bool {
return c.Log || c.LogFormatterEnabled()
}
// HTTPEnabled returns true iff HTTP is not empty
func (c *Config) HTTPEnabled() bool {
return c.HTTP != ""
}
// LogFormatterEnabled returns true iff LogFormatter is not empty
func (c *Config) LogFormatterEnabled() bool {
return c.LogFormatter != ""
}