backend

package
v0.8.2-rc1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GET    = "GET"
	POST   = "POST"
	DELETE = "DELETE"
)

Variables

This section is empty.

Functions

func ConvertEndpointIdsToRoutingNode

func ConvertEndpointIdsToRoutingNode(
	endpointList []*alertingv1.AlertEndpoint,
	req *alertingv1.AttachedEndpoints,
	id string,

) (*alertingv1.RoutingNode, error)

func NewApiPipline

func NewApiPipline(ctx context.Context, apis []*AlertManagerAPI, chainRetrier *backoffv2.Policy) error

Apis to be called in succession, if failed restart the entire pipeline

func NewExpectStatusCodes

func NewExpectStatusCodes(expectedCodes []int) func(*http.Response) error

func NewExpectStatusOk

func NewExpectStatusOk() func(*http.Response) error

Types

type Alert

type Alert struct {

	// generator URL
	// Format: uri
	GeneratorURL strfmt.URI `json:"generatorURL,omitempty"`

	// labels
	// Required: true
	Labels LabelSet `json:"labels"`
}

Alert alert

swagger:model alert

type AlertGroup

type AlertGroup struct {
	Labels   map[string]string `json:"labels"`
	Receiver Receiver          `json:"receiver"`
	Alerts   []GettableAlert   `json:"alerts"`
}

AlertGroup struct for AlertGroup

type AlertManagerAPI

type AlertManagerAPI struct {
	*AlertManagerApiOptions
	Endpoint string
	Api      string
	Route    string
	Verb     string
	// contains filtered or unexported fields
}

func NewAlertManagerDeleteSilenceClient

func NewAlertManagerDeleteSilenceClient(ctx context.Context, endpoint, silenceId string, opts ...AlertManagerApiOption) *AlertManagerAPI

func NewAlertManagerGetAlertsClient

func NewAlertManagerGetAlertsClient(ctx context.Context, endpoint string, opts ...AlertManagerApiOption) *AlertManagerAPI

func NewAlertManagerGetSilenceClient

func NewAlertManagerGetSilenceClient(ctx context.Context, endpoint string, opts ...AlertManagerApiOption) *AlertManagerAPI

func NewAlertManagerOpniConfigClient

func NewAlertManagerOpniConfigClient(ctx context.Context, endpoint string, opts ...AlertManagerApiOption) *AlertManagerAPI

func NewAlertManagerPostAlertClient

func NewAlertManagerPostAlertClient(ctx context.Context, endpoint string, opts ...AlertManagerApiOption) *AlertManagerAPI

func NewAlertManagerPostSilenceClient

func NewAlertManagerPostSilenceClient(ctx context.Context, endpoint string, opts ...AlertManagerApiOption) *AlertManagerAPI

func NewAlertManagerReadyClient

func NewAlertManagerReadyClient(ctx context.Context, endpoint string, opts ...AlertManagerApiOption) *AlertManagerAPI

func NewAlertManagerReceiversClient

func NewAlertManagerReceiversClient(ctx context.Context, endpoint string, opts ...AlertManagerApiOption) *AlertManagerAPI

func NewAlertManagerReloadClient

func NewAlertManagerReloadClient(ctx context.Context, endpoint string, opts ...AlertManagerApiOption) *AlertManagerAPI

func NewAlertManagerStatusClient

func NewAlertManagerStatusClient(ctx context.Context, endpoint string, opts ...AlertManagerApiOption) *AlertManagerAPI

func (*AlertManagerAPI) Construct

func (a *AlertManagerAPI) Construct() string

func (*AlertManagerAPI) ConstructHTTP

func (a *AlertManagerAPI) ConstructHTTP() string

func (*AlertManagerAPI) ConstructHTTPS

func (a *AlertManagerAPI) ConstructHTTPS() string

func (*AlertManagerAPI) DoRequest

func (a *AlertManagerAPI) DoRequest() error

func (*AlertManagerAPI) WithAPIV1

func (a *AlertManagerAPI) WithAPIV1() *AlertManagerAPI

WithAPIV1 ## Reference https://prometheus.io/docs/alerting/latest/clients/

func (*AlertManagerAPI) WithAPIV2

func (a *AlertManagerAPI) WithAPIV2() *AlertManagerAPI

WithAPIV2 ## OpenAPI reference https://github.com/prometheus/alertmanager/blob/main/api/v2/openapi.yaml

type AlertManagerApiOption

type AlertManagerApiOption func(*AlertManagerApiOptions)

func WithDefaultRetrier

func WithDefaultRetrier() AlertManagerApiOption

func WithExpectClosure

func WithExpectClosure(expectClosure func(*http.Response) error) AlertManagerApiOption

func WithHttpClient

func WithHttpClient(client *http.Client) AlertManagerApiOption

func WithLogger

func WithLogger(logger *zap.SugaredLogger) AlertManagerApiOption

func WithPostAlertBody

func WithPostAlertBody(conditionId string, labels, annotations map[string]string) AlertManagerApiOption

func WithPostResolveAlertBody

func WithPostResolveAlertBody(conditionId string, labels, annotations map[string]string) AlertManagerApiOption

func WithPostSilenceBody

func WithPostSilenceBody(conditionId string, duration time.Duration, silenceId *string) AlertManagerApiOption

providing a silence id here indicates we are updating an existing silence

func WithRequestBody

func WithRequestBody(body []byte) AlertManagerApiOption

func WithRetrier

func WithRetrier(retrier backoffv2.Policy) AlertManagerApiOption

func WithURLValues

func WithURLValues(values url.Values) AlertManagerApiOption

type AlertManagerApiOptions

type AlertManagerApiOptions struct {
	// contains filtered or unexported fields
}

func NewDefaultAlertManagerOptions

func NewDefaultAlertManagerOptions() *AlertManagerApiOptions

type AlertStatus

type AlertStatus struct {

	// inhibited by
	// Required: true
	InhibitedBy []string `json:"inhibitedBy"`

	// silenced by
	// Required: true
	SilencedBy []string `json:"silencedBy"`

	// state
	// Required: true
	// Enum: [unprocessed active suppressed]
	State *string `json:"state"`
}

type GettableAlert

type GettableAlert struct {

	// annotations
	// Required: true
	Annotations LabelSet `json:"annotations"`

	// ends at
	// Required: true
	// Format: date-time
	EndsAt *strfmt.DateTime `json:"endsAt"`

	// fingerprint
	// Required: true
	Fingerprint *string `json:"fingerprint"`

	// receivers
	// Required: true
	Receivers []*Receiver `json:"receivers"`

	// starts at
	// Required: true
	// Format: date-time
	StartsAt *strfmt.DateTime `json:"startsAt"`

	// status
	// Required: true
	Status *AlertStatus `json:"status"`

	// updated at
	// Required: true
	// Format: date-time
	UpdatedAt *strfmt.DateTime `json:"updatedAt"`

	Alert
}

GettableAlert gettable alert

swagger:model gettableAlert

type LabelSet

type LabelSet map[string]string

type Matcher

type Matcher struct {
	Name    string `json:"name"`
	Value   string `json:"value"`
	IsRegex bool   `json:"isRegex"`
	IsEqual *bool  `json:"isEqual,omitempty"`
}

type PostSilencesResponse

type PostSilencesResponse struct {
	SilenceID *string `json:"silenceID,omitempty"`
}

func (*PostSilencesResponse) GetSilenceId

func (p *PostSilencesResponse) GetSilenceId() string

type PostableAlert

type PostableAlert struct {
	StartsAt     *time.Time         `json:"startsAt,omitempty"`
	EndsAt       *time.Time         `json:"endsAt,omitempty"`
	Annotations  *map[string]string `json:"annotations,omitempty"`
	Labels       map[string]string  `json:"labels"`
	GeneratorURL *string            `json:"generatorURL,omitempty"`
}

PostableAlert : corresponds to the data AlertManager API needs to trigger alerts

func (*PostableAlert) Must

func (p *PostableAlert) Must() error

func (*PostableAlert) WithAnnotations

func (p *PostableAlert) WithAnnotations(key, value string)

WithAnnotations adds the runtime information to the alert.

func (*PostableAlert) WithCondition

func (p *PostableAlert) WithCondition(conditionId string)

WithCondition In our basic model each receiver is uniquely identified by its name, which in AlertManager can be routed to by the label `alertname`.

func (*PostableAlert) WithLabels

func (p *PostableAlert) WithLabels(key, value string)

type PostableSilence

type PostableSilence struct {
	Id        *string   `json:"id,omitempty"`
	Matchers  []Matcher `json:"matchers"`
	StartsAt  time.Time `json:"startsAt"`
	EndsAt    time.Time `json:"endsAt"`
	CreatedBy string    `json:"createdBy"`
	Comment   string    `json:"comment"`
}

PostableSilence struct for PostableSilence

func (*PostableSilence) Must

func (p *PostableSilence) Must() error

func (*PostableSilence) WithCondition

func (p *PostableSilence) WithCondition(conditionId string)

WithCondition In our basic model each receiver is uniquely identified by its name, which in AlertManager can be routed to by the label `alertname`.

func (*PostableSilence) WithDuration

func (p *PostableSilence) WithDuration(dur time.Duration)

func (*PostableSilence) WithSilenceId

func (p *PostableSilence) WithSilenceId(silenceId string)

type Receiver

type Receiver struct {

	// name
	// Required: true
	Name *string `json:"name"`
}

Receiver receiver

swagger:model receiver

Jump to

Keyboard shortcuts

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