alerting

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Case

type Case interface {
	prometheus.Collector

	Name() string
}

Case represents a metric that can be used for exporting, then verified against an Alertmanager webhook

func NewGaugeCase

func NewGaugeCase(name string) Case

NewGaugeCase creates a gauge metric that exposes the current time when collected.

type CortexClient

type CortexClient interface {
	CreateAlertmanagerConfig(ctx context.Context, cfg string, templates map[string]string) error
	CreateRuleGroup(ctx context.Context, namespace string, rg rwrulefmt.RuleGroup) error
}

CortexClient represents a client for syncing ruler and alertmanager configuration with Cortex

type GaugeCase

type GaugeCase struct {
	prometheus.GaugeFunc
	// contains filtered or unexported fields
}

GaugeCase represents a case in the form of a gauge

func (*GaugeCase) Name

func (d *GaugeCase) Name() string

Name represents the name of the case

type Receiver

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

Receiver implements the Alertmanager webhook receiver. It evaluates the received alerts, finds if the alert holds an annonnation with a label of "time", and if it does computes now - time for a total duration.

func NewReceiver

func NewReceiver(cfg ReceiverConfig, log log.Logger, reg prometheus.Registerer) (*Receiver, error)

NewReceiver returns an alertmanager webhook receiver

func (*Receiver) RegisterRoutes

func (r *Receiver) RegisterRoutes(router *mux.Router)

RegisterRoutes registers the receiver API routes with the provided router.

type ReceiverConfig

type ReceiverConfig struct {
	RoundtripLabel string
	PurgeLookback  time.Duration
	PurgeInterval  time.Duration
}

ReceiverConfig implements the configuration for the alertmanager webhook receiver

func (*ReceiverConfig) RegisterFlags

func (cfg *ReceiverConfig) RegisterFlags(f *flag.FlagSet)

RegisterFlags registers the flags for the alertmanager webhook receiver

type Runner

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

Runner runs a set of cases for evaluation

func NewRunner

func NewRunner(cfg RunnerConfig, logger log.Logger) (*Runner, error)

NewRunner returns a runner that holds cases for collection and evaluation.

func (*Runner) Add

func (r *Runner) Add(tc Case)

Add a new TestCase.

func (*Runner) Collect

func (r *Runner) Collect(c chan<- prometheus.Metric)

Collect implements prometheus.Collector.

func (*Runner) Describe

func (r *Runner) Describe(c chan<- *prometheus.Desc)

Describe implements prometheus.Collector.

func (*Runner) Stop

func (r *Runner) Stop()

Stop the checking goroutine.

type RunnerConfig

type RunnerConfig struct {
	AlertmanagerURL string
	AlertmanagerID  string
	RulerURL        string
	RulerID         string
	Key             string

	RulesConfigFile        string
	AlertmanagerConfigFile string
	ConfigSyncInterval     time.Duration
}

func (*RunnerConfig) RegisterFlags

func (cfg *RunnerConfig) RegisterFlags(f *flag.FlagSet)

Jump to

Keyboard shortcuts

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