...

Package provider

import "github.com/prometheus/alertmanager/provider"
Overview
Index
Subdirectories

Overview ▾

Variables

ErrNotFound is returned if a provider cannot find a requested item.

var ErrNotFound = fmt.Errorf("item not found")

type AlertIterator

AlertIterator is an Iterator for Alerts.

type AlertIterator interface {
    Iterator
    // Next returns a channel that will be closed once the iterator is
    // exhausted. It is not necessary to exhaust the iterator but Close must
    // be called in any case to release resources used by the iterator (even
    // if the iterator is exhausted).
    Next() <-chan *types.Alert
}

func NewAlertIterator

func NewAlertIterator(ch <-chan *types.Alert, done chan struct{}, err error) AlertIterator

NewAlertIterator returns a new AlertIterator based on the generic alertIterator type

type Alerts

Alerts gives access to a set of alerts. All methods are goroutine-safe.

type Alerts interface {
    // Subscribe returns an iterator over active alerts that have not been
    // resolved and successfully notified about.
    // They are not guaranteed to be in chronological order.
    Subscribe() AlertIterator
    // GetPending returns an iterator over all alerts that have
    // pending notifications.
    GetPending() AlertIterator
    // Get returns the alert for a given fingerprint.
    Get(model.Fingerprint) (*types.Alert, error)
    // Put adds the given set of alerts to the set.
    Put(...*types.Alert) error
}

type Iterator

Iterator provides the functions common to all iterators. To be useful, a specific iterator interface (e.g. AlertIterator) has to be implemented that provides a Next method.

type Iterator interface {
    // Err returns the current error. It is not safe to call it concurrently
    // with other iterator methods or while reading from a channel returned
    // by the iterator.
    Err() error
    // Close must be called to release resources once the iterator is not
    // used anymore.
    Close()
}

Subdirectories

Name Synopsis
..
mem