config

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Listen        string              `yaml:"listen"`
	MetricsPath   string              `yaml:"metrics_path"`
	AlertsPath    string              `yaml:"alerts_path"`
	Receivers     map[string]Receiver `yaml:"receivers"`
	TimeIntervals TimeIntervalsMap    `yaml:"time_intervals"`
}

func DefaultConfig

func DefaultConfig() Config

func (*Config) UnmarshalYAML

func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the Unmarshaller interface for Config

type Match

type Match struct {
	Labels map[string]utils.StringArray `yaml:"labels"`
	Times  []string                     `yaml:"times"`
}

func (*Match) IsLabelMatch

func (m *Match) IsLabelMatch(labels map[string]string) bool

func (*Match) IsMatch

func (m *Match) IsMatch(timeIntervalsMap TimeIntervalsMap, labels map[string]string, time time.Time) bool

func (*Match) IsTimeMatch

func (m *Match) IsTimeMatch(timeIntervalsMap TimeIntervalsMap, time time.Time) bool

type Receiver

type Receiver struct {
	Rules  []Rule `yaml:"rules"`
	Target Target `yaml:"target"`
}

type Rule

type Rule struct {
	Match    []Match `yaml:"match"`
	NotMatch []Match `yaml:"not_match"`
}

func (*Rule) IsMatch

func (r *Rule) IsMatch(timeIntervalsMap TimeIntervalsMap, labels map[string]string, time time.Time) bool

type SafeConfig

type SafeConfig struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

SafeConfig is a thread safe config handler

func New

func New(configFile string) SafeConfig

New creates a new SafeConfig instance

func (*SafeConfig) Get

func (sc *SafeConfig) Get() *Config

Get returns the current config

func (*SafeConfig) LoadConfig

func (sc *SafeConfig) LoadConfig() (err error)

LoadConfig reads and parses the file from disk

type Target

type Target struct {
	URL        am_config.URL              `yaml:"url"`
	HTTPConfig commoncfg.HTTPClientConfig `yaml:"http_config"`
	HTTPClient *http.Client
}

func (*Target) CreateProxy added in v0.2.0

func (t *Target) CreateProxy(log *zap.Logger) (*httputil.ReverseProxy, error)

func (*Target) UnmarshalYAML

func (t *Target) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the Unmarshaller interface for Target

type TimeIntervalsMap

type TimeIntervalsMap map[string][]timeinterval.TimeInterval

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL