alert

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: Apache-2.0 Imports: 21 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertmanagerClient added in v0.2.0

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

Get alerts from Alertmanager

func NewAlertmanagerClient added in v0.2.0

func NewAlertmanagerClient(address, receiver string, silenced bool) (*AlertmanagerClient, error)

func (*AlertmanagerClient) GetAlerts added in v0.2.0

func (a *AlertmanagerClient) GetAlerts(ctx context.Context) ([]promv1.Alert, bool, error)

type Cache

type Cache interface {
	// Get will return the currently cached alerts for a given node. An error
	// will be returned if the cache is not populated, node specific filters
	// cannot be run, or if the last retrieval resulted in an error. The time
	// returned is the time of the last retrieval attempt.
	Get(nodeName string) ([]promv1.Alert, time.Time, error)
}

Cache outlines an interface to interact with cached alerts

type Client added in v0.2.0

type Client interface {
	GetAlerts(context.Context) ([]promv1.Alert, bool, error)
}

func NewPrometheusClient added in v0.2.0

func NewPrometheusClient(address string) (Client, error)

func NewPrometheusMultiClient added in v0.2.0

func NewPrometheusMultiClient(addresses []string) (Client, error)

type PromClient added in v0.2.0

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

Get alerts from a single prometheus

func (*PromClient) GetAlerts added in v0.2.0

func (p *PromClient) GetAlerts(ctx context.Context) ([]promv1.Alert, bool, error)

type PromMultiClient added in v0.2.0

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

Get alerts from multiple promethei and combine them

func (*PromMultiClient) GetAlerts added in v0.2.0

func (p *PromMultiClient) GetAlerts(ctx context.Context) ([]promv1.Alert, bool, error)

type Syncer

type Syncer interface {
	manager.LeaderElectionRunnable
	manager.Runnable
	Cache
	// SyncOnce enables the cache to be initialized before use by the Manager
	SyncOnce()
}

Syncer is an interface designed to be run by a manager.Manager that also provides a Cache interface

func NewSyncer

func NewSyncer(
	alertClient Client,
	log logr.Logger,
	prom prometheus.Registerer,
	celExpression string,
	syncInterval time.Duration,
) (Syncer, error)

NewSyncer provides an implementation of Syncer that gets alerts at syncInterval

Jump to

Keyboard shortcuts

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