-
Notifications
You must be signed in to change notification settings - Fork 486
/
global.go
35 lines (27 loc) · 977 Bytes
/
global.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
package instance
import (
"reflect"
"time"
"github.com/prometheus/prometheus/config"
)
// DefaultGlobalConfig holds default global settings to be used across all instances.
var DefaultGlobalConfig = GlobalConfig{
Prometheus: config.DefaultGlobalConfig,
}
// GlobalConfig holds global settings that apply to all instances by default.
type GlobalConfig struct {
Prometheus config.GlobalConfig `yaml:",inline"`
RemoteWrite []*config.RemoteWriteConfig `yaml:"remote_write,omitempty"`
ExtraMetrics bool `yaml:"-"`
DisableKeepAlives bool `yaml:"-"`
IdleConnTimeout time.Duration `yaml:"-"`
}
// UnmarshalYAML implements yaml.Unmarshaler.
func (c *GlobalConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
*c = DefaultGlobalConfig
type plain GlobalConfig
return unmarshal((*plain)(c))
}
func (c GlobalConfig) IsZero() bool {
return reflect.DeepEqual(c, GlobalConfig{}) || reflect.DeepEqual(c, DefaultGlobalConfig)
}