 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Overview ¶
Package alert contains logic to send alert notifications to Alertmanager clusters.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert struct {
	// Label value pairs for purpose of aggregation, matching, and disposition
	// dispatching. This must minimally include an "alertname" label.
	Labels labels.Labels `json:"labels"`
	// Extra key/value information which does not define alert identity.
	Annotations labels.Labels `json:"annotations"`
	// The known time range for this alert. Start and end time are both optional.
	StartsAt     time.Time `json:"startsAt,omitempty"`
	EndsAt       time.Time `json:"endsAt,omitempty"`
	GeneratorURL string    `json:"generatorURL,omitempty"`
}
    Alert is a generic representation of an alert in the Prometheus eco-system.
func (*Alert) Hash ¶
Hash returns a hash over the alert. It is equivalent to the alert labels hash.
func (*Alert) Name ¶
Name returns the name of the alert. It is equivalent to the "alertname" label.
func (*Alert) Resolved ¶
Resolved returns true iff the activity interval ended in the past.
func (*Alert) ResolvedAt ¶
ResolvedAt returns true off the activity interval ended before the given timestamp.
type Queue ¶
type Queue struct {
	// contains filtered or unexported fields
}
    Queue is a queue of alert notifications waiting to be sent. The queue is consumed in batches and entries are dropped at the front if it runs full.
func NewQueue ¶
func NewQueue(logger log.Logger, reg prometheus.Registerer, capacity, maxBatchSize int, externalLset labels.Labels, excludeLabels []string) *Queue
NewQueue returns a new queue. The given label set is attached to all alerts pushed to the queue. The given exclude label set tells what label names to drop including external labels.
func (*Queue) Pop ¶
Pop takes a batch of alerts from the front of the queue. The batch size is limited according to the queues maxBatchSize limit. It blocks until elements are available or a termination signal is send on termc.
type Sender ¶
type Sender struct {
	// contains filtered or unexported fields
}
    Sender sends notifications to a dynamic set of alertmanagers.
func NewSender ¶
func NewSender( logger log.Logger, reg prometheus.Registerer, alertmanagers func() []*url.URL, doReq func(req *http.Request) (*http.Response, error), timeout time.Duration, ) *Sender
NewSender returns a new sender. On each call to Send the entire alert batch is sent to each Alertmanager returned by the getter function.
       Source Files
      ¶
      Source Files
      ¶
    
- alert.go