Documentation ¶
Index ¶
- type NotificationHandler
- func (n *NotificationHandler) ApplyConfig(conf *config.Config) bool
- func (n *NotificationHandler) Collect(ch chan<- prometheus.Metric)
- func (n *NotificationHandler) Describe(ch chan<- *prometheus.Desc)
- func (n *NotificationHandler) Run()
- func (n *NotificationHandler) Stop()
- func (n *NotificationHandler) SubmitReqs(reqs NotificationReqs)
- type NotificationHandlerOptions
- type NotificationReq
- type NotificationReqs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NotificationHandler ¶
type NotificationHandler struct {
// contains filtered or unexported fields
}
NotificationHandler is responsible for dispatching alert notifications to an alert manager service.
func NewNotificationHandler ¶
func NewNotificationHandler(o *NotificationHandlerOptions) *NotificationHandler
NewNotificationHandler constructs a new NotificationHandler.
func (*NotificationHandler) ApplyConfig ¶
func (n *NotificationHandler) ApplyConfig(conf *config.Config) bool
ApplyConfig updates the status state as the new config requires. Returns true on success.
func (*NotificationHandler) Collect ¶
func (n *NotificationHandler) Collect(ch chan<- prometheus.Metric)
Collect implements prometheus.Collector.
func (*NotificationHandler) Describe ¶
func (n *NotificationHandler) Describe(ch chan<- *prometheus.Desc)
Describe implements prometheus.Collector.
func (*NotificationHandler) Run ¶
func (n *NotificationHandler) Run()
Run dispatches notifications continuously.
func (*NotificationHandler) Stop ¶
func (n *NotificationHandler) Stop()
Stop shuts down the notification handler.
func (*NotificationHandler) SubmitReqs ¶
func (n *NotificationHandler) SubmitReqs(reqs NotificationReqs)
SubmitReqs queues the given notification requests for processing.
type NotificationHandlerOptions ¶
type NotificationHandlerOptions struct { AlertmanagerURL string QueueCapacity int Deadline time.Duration }
NotificationHandlerOptions are the configurable parameters of a NotificationHandler.
type NotificationReq ¶
type NotificationReq struct { // Short-form alert summary. May contain text/template-style interpolations. Summary string // Longer alert description. May contain text/template-style interpolations. Description string // A reference to the runbook for the alert. Runbook string // Labels associated with this alert notification, including alert name. Labels model.LabelSet // Current value of alert Value model.SampleValue // Since when this alert has been active (pending or firing). ActiveSince time.Time // A textual representation of the rule that triggered the alert. RuleString string // Prometheus console link to alert expression. GeneratorURL string }
NotificationReq is a request for sending a notification to the alert manager for a single alert vector element.
type NotificationReqs ¶
type NotificationReqs []*NotificationReq
NotificationReqs is just a short-hand for []*NotificationReq. No methods attached. Arguably, it's more confusing than helpful. Perhaps we should remove it...