config

package
v3.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func BaseDirPath

func BaseDirPath() string

Types

type Config

type Config struct {
	CustomExcludeAnnotation string           `yaml:"customExcludeAnnotation"`
	CustomDisableComment    string           `yaml:"customDisableComment"`
	ValidationRules         []ValidationRule `yaml:"validationRules"`
	Prometheus              PrometheusConfig `yaml:"prometheus"`
}

type Loader

type Loader struct {
	ConfigPath string
}

func NewLoader

func NewLoader(cfgPath string) Loader

func (*Loader) Load

func (l *Loader) Load() (*Config, error)

type PrometheusConfig

type PrometheusConfig struct {
	URL                   string        `yaml:"url"`
	Timeout               time.Duration `yaml:"timeout" default:"30s"`
	InsecureSkipTLSVerify bool          `yaml:"insecureSkipTlsVerify"`
	CacheFile             string        `yaml:"cacheFile,omitempty" default:".promruval_cache.json"`
	MaxCacheAge           time.Duration `yaml:"maxCacheAge,omitempty" default:"1h"`
	BearerTokenFile       string        `yaml:"bearerTokenFile,omitempty"`
	QueryOffset           time.Duration `yaml:"queryOffset,omitempty" default:"1m"`
	QueryLookback         time.Duration `yaml:"queryLookback,omitempty" default:"20m"`
}

func (*PrometheusConfig) UnmarshalYAML

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

type ValidationRule

type ValidationRule struct {
	Name        string            `yaml:"name"`
	Scope       ValidationScope   `yaml:"scope"`
	Validations []ValidatorConfig `yaml:"validations"`
}

type ValidationScope

type ValidationScope string
const (
	AlertScope         ValidationScope = "Alert"
	RecordingRuleScope ValidationScope = "Recording rule"
	AllRulesScope      ValidationScope = "All rules"
	GroupScope         ValidationScope = "Group"
	AllScope           ValidationScope = "All"
)

func (*ValidationScope) UnmarshalYAML

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

type ValidatorConfig

type ValidatorConfig struct {
	ValidatorType     string    `yaml:"type"`
	AdditionalDetails string    `yaml:"additionalDetails"`
	Params            yaml.Node `yaml:"params"`
	ParamsFromFile    string    `yaml:"paramsFromFile"`
}

func (*ValidatorConfig) UnmarshalYAML

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

Jump to

Keyboard shortcuts

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