common

package
v1.34.7 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitTemplateFunc added in v1.34.6

func InitTemplateFunc(externalURL *url.URL)

InitTemplateFunc returns template helper functions

func ValidateAnnotations

func ValidateAnnotations(annotations map[string]string) error

ValidateAnnotations validate annotations for possible template error, uses empty data for template population

Types

type Alert

type Alert struct {
	Group       string
	Name        string
	Labels      []datasource.Label
	Annotations map[string]string

	Start time.Time
	End   time.Time
	Value float64
}

Alert the triggered alert

func AlertsFromMetrics

func AlertsFromMetrics(metrics []datasource.Metric, group string, rule Rule, start, end time.Time) []Alert

AlertsFromMetrics converts metrics to alerts by alert Rule

type Group

type Group struct {
	Name  string
	Rules []Rule
}

Group grouping array of alert

type Rule

type Rule struct {
	Name        string            `yaml:"alert"`
	Expr        string            `yaml:"expr"`
	For         time.Duration     `yaml:"for"`
	Labels      map[string]string `yaml:"labels"`
	Annotations map[string]string `yaml:"annotations"`
}

Rule is basic alert entity

func (Rule) Validate

func (r Rule) Validate() error

Validate validates rule

type Time added in v1.34.6

type Time int64

Time is the number of milliseconds since the epoch (1970-01-01 00:00 UTC) excluding leap seconds.

func TimeFromUnixNano added in v1.34.6

func TimeFromUnixNano(t int64) Time

TimeFromUnixNano returns the Time equivalent to the Unix Time t provided in nanoseconds.

func (Time) Time added in v1.34.6

func (t Time) Time() time.Time

Time returns the time.Time representation of t.

Jump to

Keyboard shortcuts

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