Version: v0.0.0-...-e0f67db Latest Latest

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

Go to latest
Published: Dec 18, 2015 License: Apache-2.0 Imports: 10 Imported by: 0




This section is empty.


View Source
var DefaultFuncs = FuncMap{
	"toUpper": strings.ToUpper,
	"toLower": strings.ToLower,
	"title":   strings.Title,

	"join": func(sep string, s []string) string {
		return strings.Join(s, sep)


This section is empty.


type Alert

type Alert struct {
	Status       string
	Labels       KV
	Annotations  KV
	WasSilenced  bool
	WasInhibited bool

Alert holds one alert for notification templates.

type Alerts

type Alerts []Alert

Alerts is a list of Alert objects.

func (Alerts) Firing

func (as Alerts) Firing() []Alert

Firing returns the subset of alerts that are firing.

func (Alerts) Resolved

func (as Alerts) Resolved() []Alert

Resolved returns the subset of alerts that are resolved.

type Data

type Data struct {
	Receiver string
	Status   string
	Alerts   Alerts

	GroupLabels       KV
	CommonLabels      KV
	CommonAnnotations KV

	ExternalURL string

Data is the data passed to notification templates. End-users should not be exposed to Go's type system, as this will confuse them and prevent simple things like simple equality checks to fail. Map everything to float64/string.

type FuncMap

type FuncMap map[string]interface{}

type KV

type KV map[string]string

KV is a set of key/value string pairs.

func (KV) Names

func (kv KV) Names() []string

Names returns the names of the label names in the LabelSet.

func (KV) Remove

func (kv KV) Remove(keys []string) KV

Remove returns a copy of the key/value set without the given keys.

func (KV) SortedPairs

func (kv KV) SortedPairs() Pairs

SortedPairs returns a sorted list of key/value pairs.

func (KV) Values

func (kv KV) Values() []string

Values returns a list of the values in the LabelSet.

type Pair

type Pair struct {
	Name, Value string

Pair is a key/value string pair.

type Pairs

type Pairs []Pair

Pairs is a list of key/value string pairs.

func (Pairs) Names

func (ps Pairs) Names() []string

Names returns a list of names of the pairs.

func (Pairs) Values

func (ps Pairs) Values() []string

Values returns a list of values of the pairs.

type Template

type Template struct {
	ExternalURL *url.URL
	// contains filtered or unexported fields

Template bundles a text and a html template instance.

func FromGlobs

func FromGlobs(paths ...string) (*Template, error)

FromGlobs calls ParseGlob on all path globs provided and returns the resulting Template.

func (*Template) Data

func (t *Template) Data(recv string, groupLabels model.LabelSet, alerts ...*types.Alert) *Data

Data assembles data for template expansion.

func (*Template) ExecuteHTMLString

func (t *Template) ExecuteHTMLString(html string, data interface{}) (string, error)

ExecuteHTMLString needs a meaningful doc comment (TODO(fabxc)).

func (*Template) ExecuteTextString

func (t *Template) ExecuteTextString(text string, data interface{}) (string, error)

ExecuteTextString needs a meaningful doc comment (TODO(fabxc)).

Source Files


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL