config

package
v1.54.0-cluster Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2021 License: Apache-2.0 Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashRule added in v1.37.1

func HashRule(r Rule) uint64

HashRule hashes significant Rule fields into unique hash that supposed to define Rule uniqueness

Types

type Group

type Group struct {
	Type        datasource.Type `yaml:"type,omitempty"`
	File        string
	Name        string        `yaml:"name"`
	Interval    time.Duration `yaml:"interval,omitempty"`
	Rules       []Rule        `yaml:"rules"`
	Concurrency int           `yaml:"concurrency"`
	// Checksum stores the hash of yaml definition for this group.
	// May be used to detect any changes like rules re-ordering etc.
	Checksum string

	// Catches all undefined fields and must be empty after parsing.
	XXX map[string]interface{} `yaml:",inline"`
}

Group contains list of Rules grouped into entity with one name and evaluation interval

func Parse

func Parse(pathPatterns []string, validateAnnotations, validateExpressions bool) ([]Group, error)

Parse parses rule configs from given file patterns

func (*Group) UnmarshalYAML added in v1.41.0

func (g *Group) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

func (*Group) Validate added in v1.37.0

func (g *Group) Validate(validateAnnotations, validateExpressions bool) error

Validate check for internal Group or Rule configuration errors

type PromDuration added in v1.44.0

type PromDuration struct {
	// contains filtered or unexported fields
}

PromDuration is Prometheus duration.

func NewPromDuration added in v1.44.0

func NewPromDuration(d time.Duration) PromDuration

NewPromDuration returns PromDuration for given d.

func (*PromDuration) Duration added in v1.44.0

func (pd *PromDuration) Duration() time.Duration

Duration returns duration for pd.

func (PromDuration) MarshalYAML added in v1.49.0

func (pd PromDuration) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler interface.

func (*PromDuration) UnmarshalYAML added in v1.44.0

func (pd *PromDuration) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler interface.

type Rule added in v1.34.4

type Rule struct {
	ID          uint64
	Type        datasource.Type   `yaml:"type,omitempty"`
	Record      string            `yaml:"record,omitempty"`
	Alert       string            `yaml:"alert,omitempty"`
	Expr        string            `yaml:"expr"`
	For         PromDuration      `yaml:"for"`
	Labels      map[string]string `yaml:"labels,omitempty"`
	Annotations map[string]string `yaml:"annotations,omitempty"`

	// Catches all undefined fields and must be empty after parsing.
	XXX map[string]interface{} `yaml:",inline"`
}

Rule describes entity that represent either recording rule or alerting rule.

func (*Rule) Name added in v1.34.4

func (r *Rule) Name() string

Name returns Rule name according to its type

func (*Rule) UnmarshalYAML added in v1.37.1

func (r *Rule) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

func (*Rule) Validate added in v1.37.0

func (r *Rule) Validate() error

Validate check for Rule configuration errors

Jump to

Keyboard shortcuts

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