alert

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StatusUnknown is status of this alert is unknown
	StatusUnknown = iota
	//StatusFiring is the status of this alert is currently firing
	StatusFiring
	// StatusResolved is the status of this alert has been resovled
	StatusResolved
)
View Source
const (
	// QueueNew ...
	QueueNew = iota
	// QueueUpdateAdd ...
	QueueUpdateAdd
	// QueueUpdateDelete ...
	QueueUpdateDelete
	// QueueDelete ...
	QueueDelete
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Alert

type Alert struct {
	Info   Info
	Source Source
}

Alert contains both informational fields, and the source of an alert.

func ParseAlerts

func ParseAlerts(p Parser, r io.Reader) ([]*Alert, error)

ParseAlerts runs the parser `p` against the data in `r`

type Info

type Info struct {
	Status  Status // unknown|firing|resolved
	Name    string // Name of the alert
	Hash    string // A unique identifier for this specific alert
	Syscall string // the name of the syscall that triggered the alert.
	URL     string // GeneratorURL
}

Info contains specific information about an alert as it pertains to an AlertSource

type Parser

type Parser interface {
	ParseAlerts(r io.Reader) ([]*Alert, error)
}

Parser is an abstraction interface around parsing raw alert data.

type Prometheus

type Prometheus struct {
	Parser
}

Prometheus is our parser for prometheus-sourced alerts

func (*Prometheus) ParseAlerts

func (p *Prometheus) ParseAlerts(r io.Reader) ([]*Alert, error)

ParseAlerts parses prometheus-formatted data from `r`

type Queue

type Queue struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Queue is the abstraction around a queue of alerts.

func NewAlertQueue

func NewAlertQueue() (*Queue, error)

NewAlertQueue creates a new instance of the alert queue.

func (*Queue) Push

func (aq *Queue) Push(alert *Alert, cb QueueCallback) error

Push will process, update internal caches and queues, and emit callbacks for new entries, updates, and deletes.

type QueueCallback

type QueueCallback func(t QueueType, src *Source, nfo *Info)

QueueCallback is a function to call for any process/updates

type QueueType

type QueueType int

QueueType just defines QueueUnknown/QueueNew etc...

func (QueueType) String

func (t QueueType) String() string

type Source

type Source struct {
	Namespace string // the k8s namespace
	Pod       string // the k8s pod name
	Container string // the name of the k8s container
}

Source contains all the relevant information about an entity that triggered this alert.

type Status

type Status int

Status is a reference to the state of which this alert is currently in.

Jump to

Keyboard shortcuts

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