v2

package
v0.0.0-...-6bc65d5 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APILabelSetToModelLabelSet

func APILabelSetToModelLabelSet(apiLabelSet open_api_models.LabelSet) prometheus_model.LabelSet

APILabelSetToModelLabelSet converts open_api_models.LabelSet to prometheus_model.LabelSet.

func AlertToOpenAPIAlert

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

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

func CheckSilenceMatchesFilterLabels

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

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

GettableSilenceFromProto converts *silencepb.Silence to open_api_models.GettableSilence.

func ModelLabelSetToAPILabelSet

func ModelLabelSetToAPILabelSet(modelLabelSet prometheus_model.LabelSet) open_api_models.LabelSet

ModelLabelSetToAPILabelSet converts prometheus_model.LabelSet to open_api_models.LabelSet.

func OpenAPIAlertsToAlerts

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

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

func PostableSilenceToProto

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

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

func SortSilences

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,
	asf getAlertStatusFn,
	gmf groupMutedFunc,
	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
Package restapi Alertmanager API

Jump to

Keyboard shortcuts

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