filters

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllFilters = []filterConfig{
	filterConfig{
		Label:              "@alertmanager",
		LabelRe:            regexp.MustCompile("^@alertmanager$"),
		SupportedOperators: []string{regexpOperator, negativeRegexOperator, equalOperator, notEqualOperator},
		Factory:            newAlertmanagerInstanceFilter,
		Autocomplete:       alertmanagerInstanceAutocomplete,
	},
	filterConfig{
		Label:              "@state",
		LabelRe:            regexp.MustCompile("^@state$"),
		SupportedOperators: []string{equalOperator, notEqualOperator},
		Factory:            newStateFilter,
		Autocomplete:       stateAutocomplete,
	},
	filterConfig{
		Label:              "@receiver",
		LabelRe:            regexp.MustCompile("^@receiver$"),
		SupportedOperators: []string{regexpOperator, negativeRegexOperator, equalOperator, notEqualOperator},
		Factory:            newreceiverFilter,
		Autocomplete:       receiverAutocomplete,
	},
	filterConfig{
		Label:              "@age",
		LabelRe:            regexp.MustCompile("^@age$"),
		SupportedOperators: []string{lessThanOperator, moreThanOperator},
		Factory:            newAgeFilter,
		Autocomplete:       ageAutocomplete,
	},
	filterConfig{
		Label:              "@silence_jira",
		LabelRe:            regexp.MustCompile("^@silence_jira$"),
		SupportedOperators: []string{regexpOperator, negativeRegexOperator, equalOperator, notEqualOperator},
		Factory:            newSilenceJiraFilter,
		Autocomplete:       sinceJiraIDAutocomplete,
	},
	filterConfig{
		Label:              "@silence_author",
		LabelRe:            regexp.MustCompile("^@silence_author$"),
		SupportedOperators: []string{regexpOperator, negativeRegexOperator, equalOperator, notEqualOperator},
		Factory:            newSilenceAuthorFilter,
		Autocomplete:       sinceAuthorAutocomplete,
	},
	filterConfig{
		Label:              "@limit",
		LabelRe:            regexp.MustCompile("^@limit$"),
		SupportedOperators: []string{equalOperator},
		Factory:            newLimitFilter,
		Autocomplete:       limitAutocomplete,
	},
	filterConfig{
		Label:              "[a-zA-Z_][a-zA-Z0-9_]*",
		LabelRe:            regexp.MustCompile("^[a-zA-Z_][a-zA-Z0-9_]*$"),
		SupportedOperators: []string{regexpOperator, negativeRegexOperator, equalOperator, notEqualOperator, lessThanOperator, moreThanOperator},
		Factory:            newLabelFilter,
		Autocomplete:       labelAutocomplete,
	},
}

AllFilters contains the mapping of all filters along with operators they support

Functions

This section is empty.

Types

type FilterT

type FilterT interface {
	Match(alert *models.Alert, matches int) bool
	GetRawText() string
	GetHits() int
	GetIsValid() bool
	// contains filtered or unexported methods
}

FilterT provides methods for interacting with alert filters

func NewFilter

func NewFilter(expression string) FilterT

NewFilter creates new filter object from filter expression like "key=value" expression will be parsed and best filter implementation and value matcher will be selected

Jump to

Keyboard shortcuts

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