v2

package
v0.22.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2021 License: Apache-2.0 Imports: 32 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APILabelSetToModelLabelSet added in v0.22.0

func APILabelSetToModelLabelSet(apiLabelSet open_api_models.LabelSet) prometheus_model.LabelSet

APILabelSetToModelLabelSet converts open_api_models.LabelSet to prometheus_model.LabelSet.

func AlertToOpenAPIAlert added in v0.22.0

func AlertToOpenAPIAlert(alert *types.Alert, status types.AlertStatus, receivers []string) *open_api_models.GettableAlert

AlertToOpenAPIAlert converts internal alerts, alert types, and receivers to *open_api_models.GettableAlert.

func CheckSilenceMatchesFilterLabels added in v0.22.0

func CheckSilenceMatchesFilterLabels(s *silencepb.Silence, matchers []*labels.Matcher) bool

CheckSilenceMatchesFilterLabels returns true if a given silence matches a list of matchers. A silence matches a filter (list of matchers) if for all matchers in the filter, there exists a matcher in the silence such that their names, types, and values are equivalent.

func GettableSilenceFromProto added in v0.22.0

func GettableSilenceFromProto(s *silencepb.Silence) (open_api_models.GettableSilence, error)

GettableSilenceFromProto converts *silencepb.Silence to open_api_models.GettableSilence.

func ModelLabelSetToAPILabelSet added in v0.22.0

func ModelLabelSetToAPILabelSet(modelLabelSet prometheus_model.LabelSet) open_api_models.LabelSet

ModelLabelSetToAPILabelSet converts prometheus_model.LabelSet to open_api_models.LabelSet.

func OpenAPIAlertsToAlerts added in v0.22.0

func OpenAPIAlertsToAlerts(apiAlerts open_api_models.PostableAlerts) []*types.Alert

OpenAPIAlertsToAlerts converts open_api_models.PostableAlerts to []*types.Alert.

func PostableSilenceToProto added in v0.22.0

func PostableSilenceToProto(s *open_api_models.PostableSilence) (*silencepb.Silence, error)

PostableSilenceToProto converts *open_api_models.PostableSilenc to *silencepb.Silence.

func SortSilences added in v0.22.0

func SortSilences(sils open_api_models.GettableSilences)

SortSilences sorts first according to the state "active, pending, expired" then by end time or start time depending on the state. active silences should show the next to expire first pending silences are ordered based on which one starts next expired are ordered based on which one expired most recently

Types

type API

type API struct {
	Handler http.Handler
	// contains filtered or unexported fields
}

API represents an Alertmanager API v2

func NewAPI

func NewAPI(
	alerts provider.Alerts,
	gf groupsFn,
	sf getAlertStatusFn,
	silences *silence.Silences,
	peer cluster.ClusterPeer,
	l log.Logger,
	r prometheus.Registerer,
) (*API, error)

NewAPI returns a new Alertmanager API v2

func (*API) Update

func (api *API) Update(cfg *config.Config, setAlertStatus setAlertStatusFn)

Update sets the API struct members that may change between reloads of alertmanager.

Directories

Path Synopsis
Package restapi Alertmanager API API of the Prometheus Alertmanager (https://github.com/prometheus/alertmanager) Schemes: http Host: localhost BasePath: / Version: 0.0.1 License: Apache 2.0 http://www.apache.org/licenses/LICENSE-2.0.html Consumes: - application/json Produces: - application/json swagger:meta
Package restapi Alertmanager API API of the Prometheus Alertmanager (https://github.com/prometheus/alertmanager) Schemes: http Host: localhost BasePath: / Version: 0.0.1 License: Apache 2.0 http://www.apache.org/licenses/LICENSE-2.0.html Consumes: - application/json Produces: - application/json swagger:meta

Jump to

Keyboard shortcuts

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