Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aos
GitHub Repository: aos/grafana-agent
Path: blob/main/pkg/metrics/instance/global.go
4094 views
1
package instance
2
3
import (
4
"reflect"
5
"time"
6
7
"github.com/prometheus/prometheus/config"
8
)
9
10
// DefaultGlobalConfig holds default global settings to be used across all instances.
11
var DefaultGlobalConfig = GlobalConfig{
12
Prometheus: config.DefaultGlobalConfig,
13
}
14
15
// GlobalConfig holds global settings that apply to all instances by default.
16
type GlobalConfig struct {
17
Prometheus config.GlobalConfig `yaml:",inline"`
18
RemoteWrite []*config.RemoteWriteConfig `yaml:"remote_write,omitempty"`
19
20
ExtraMetrics bool `yaml:"-"`
21
DisableKeepAlives bool `yaml:"-"`
22
IdleConnTimeout time.Duration `yaml:"-"`
23
}
24
25
// UnmarshalYAML implements yaml.Unmarshaler.
26
func (c *GlobalConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
27
*c = DefaultGlobalConfig
28
29
type plain GlobalConfig
30
return unmarshal((*plain)(c))
31
}
32
33
func (c GlobalConfig) IsZero() bool {
34
return reflect.DeepEqual(c, GlobalConfig{}) || reflect.DeepEqual(c, DefaultGlobalConfig)
35
}
36
37