alertmanager

package
v2.7.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2020 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package alertmanager contains business logic of working with Alertmanager.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry

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

Registry stores alerts and delay information by IDs.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new Registry.

func (*Registry) CreateAlert

func (r *Registry) CreateAlert(id string, labels, annotations map[string]string, delayFor time.Duration)

CreateAlert creates alert from given AlertParams and adds or replaces alert with given ID in registry. If that ID wasn't present before, alert is added in the pending state. It we be transitioned to the firing state after delayFor interval. This is similar to `for` field of Prometheus alerting rule: https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/

func (*Registry) RemovePrefix

func (r *Registry) RemovePrefix(prefix string, keepIDs map[string]struct{})

RemovePrefix removes all alerts with given ID prefix except a given list of IDs.

type Service

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

Service is responsible for interactions with Alertmanager.

func New

func New(db *reform.DB, alertsRegistry *Registry) *Service

New creates new service.

func (*Service) IsReady

func (svc *Service) IsReady(ctx context.Context) error

IsReady verifies that Alertmanager works.

func (*Service) Run

func (svc *Service) Run(ctx context.Context)

Run runs Alertmanager configuration update loop until ctx is canceled.

Jump to

Keyboard shortcuts

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