Documentation ¶
Index ¶
- Constants
- func FiringAlerts(ctx context.Context) ([]uint64, bool)
- func GroupKey(ctx context.Context) (string, bool)
- func GroupLabels(ctx context.Context) (model.LabelSet, bool)
- func LoginAuth(username, password string) smtp.Auth
- func Now(ctx context.Context) (time.Time, bool)
- func ReceiverName(ctx context.Context) (string, bool)
- func RepeatInterval(ctx context.Context) (time.Duration, bool)
- func ResolvedAlerts(ctx context.Context) ([]uint64, bool)
- func WithFiringAlerts(ctx context.Context, alerts []uint64) context.Context
- func WithGroupKey(ctx context.Context, s string) context.Context
- func WithGroupLabels(ctx context.Context, lset model.LabelSet) context.Context
- func WithNow(ctx context.Context, t time.Time) context.Context
- func WithReceiverName(ctx context.Context, rcv string) context.Context
- func WithRepeatInterval(ctx context.Context, t time.Duration) context.Context
- func WithResolvedAlerts(ctx context.Context, alerts []uint64) context.Context
- type DedupStage
- type Email
- type FanoutStage
- type GossipSettleStage
- type Hipchat
- type InhibitStage
- type Integration
- type MultiStage
- type NotificationLog
- type Notifier
- type OpsGenie
- type PagerDuty
- type Pushover
- type RetryStage
- type RoutingStage
- type SetNotifiesStage
- type SilenceStage
- type Slack
- type Stage
- type StageFunc
- type VictorOps
- type WaitStage
- type Webhook
- type WebhookMessage
- type Wechat
- type WechatToken
Constants ¶
const MinTimeout = 10 * time.Second
MinTimeout is the minimum timeout that is set for the context of a call to a notification pipeline.
Variables ¶
This section is empty.
Functions ¶
func FiringAlerts ¶ added in v0.6.0
FiringAlerts extracts a slice of firing alerts from the context. Iff none exists, the second argument is false.
func GroupKey ¶
GroupKey extracts a group key from the context. Iff none exists, the second argument is false.
func GroupLabels ¶
GroupLabels extracts grouping label set from the context. Iff none exists, the second argument is false.
func Now ¶
Now extracts a now timestamp from the context. Iff none exists, the second argument is false.
func ReceiverName ¶ added in v0.5.0
ReceiverName extracts a receiver name from the context. Iff none exists, the second argument is false.
func RepeatInterval ¶
RepeatInterval extracts a repeat interval from the context. Iff none exists, the second argument is false.
func ResolvedAlerts ¶ added in v0.6.0
ResolvedAlerts extracts a slice of firing alerts from the context. Iff none exists, the second argument is false.
func WithFiringAlerts ¶ added in v0.6.0
WithFiringAlerts populates a context with a slice of firing alerts.
func WithGroupKey ¶
WithGroupKey populates a context with a group key.
func WithGroupLabels ¶
WithGroupLabels populates a context with grouping labels.
func WithReceiverName ¶ added in v0.5.0
WithReceiverName populates a context with a receiver name.
func WithRepeatInterval ¶
WithRepeatInterval populates a context with a repeat interval.
Types ¶
type DedupStage ¶ added in v0.5.0
type DedupStage struct {
// contains filtered or unexported fields
}
DedupStage filters alerts. Filtering happens based on a notification log.
func NewDedupStage ¶ added in v0.5.0
func NewDedupStage(i Integration, l NotificationLog, recv *nflogpb.Receiver) *DedupStage
NewDedupStage wraps a DedupStage that runs against the given notification log.
type Email ¶
type Email struct {
// contains filtered or unexported fields
}
Email implements a Notifier for email notifications.
type FanoutStage ¶ added in v0.5.0
type FanoutStage []Stage
FanoutStage executes its stages concurrently
func (FanoutStage) Exec ¶ added in v0.5.0
func (fs FanoutStage) Exec(ctx context.Context, l log.Logger, alerts ...*types.Alert) (context.Context, []*types.Alert, error)
Exec attempts to execute all stages concurrently and discards the results. It returns its input alerts and a types.MultiError if one or more stages fail.
type GossipSettleStage ¶ added in v0.15.0
type GossipSettleStage struct {
// contains filtered or unexported fields
}
GossipSettleStage waits until the Gossip has settled to forward alerts.
func NewGossipSettleStage ¶ added in v0.15.0
func NewGossipSettleStage(p *cluster.Peer) *GossipSettleStage
NewGossipSettleStage returns a new GossipSettleStage.
type Hipchat ¶
type Hipchat struct {
// contains filtered or unexported fields
}
Hipchat implements a Notifier for Hipchat notifications.
func NewHipchat ¶
NewHipchat returns a new Hipchat notification handler.
type InhibitStage ¶ added in v0.5.0
type InhibitStage struct {
// contains filtered or unexported fields
}
InhibitStage filters alerts through an inhibition muter.
func NewInhibitStage ¶ added in v0.5.0
func NewInhibitStage(m types.Muter) *InhibitStage
NewInhibitStage return a new InhibitStage.
type Integration ¶ added in v0.5.0
type Integration struct {
// contains filtered or unexported fields
}
An Integration wraps a notifier and its config to be uniquely identified by name and index from its origin in the configuration.
func BuildReceiverIntegrations ¶ added in v0.5.0
func BuildReceiverIntegrations(nc *config.Receiver, tmpl *template.Template, logger log.Logger) []Integration
BuildReceiverIntegrations builds a list of integration notifiers off of a receivers config.
type MultiStage ¶ added in v0.5.0
type MultiStage []Stage
A MultiStage executes a series of stages sequencially.
type NotificationLog ¶ added in v0.15.0
type Notifier ¶
A Notifier notifies about alerts under constraints of the given context. It returns an error if unsuccessful and a flag whether the error is recoverable. This information is useful for a retry logic.
type OpsGenie ¶
type OpsGenie struct {
// contains filtered or unexported fields
}
OpsGenie implements a Notifier for OpsGenie notifications.
func NewOpsGenie ¶
NewOpsGenie returns a new OpsGenie notifier.
type PagerDuty ¶
type PagerDuty struct {
// contains filtered or unexported fields
}
PagerDuty implements a Notifier for PagerDuty notifications.
func NewPagerDuty ¶
NewPagerDuty returns a new PagerDuty notifier.
type Pushover ¶
type Pushover struct {
// contains filtered or unexported fields
}
Pushover implements a Notifier for Pushover notifications.
func NewPushover ¶
NewPushover returns a new Pushover notifier.
type RetryStage ¶ added in v0.5.0
type RetryStage struct {
// contains filtered or unexported fields
}
RetryStage notifies via passed integration with exponential backoff until it succeeds. It aborts if the context is canceled or timed out.
func NewRetryStage ¶ added in v0.5.0
func NewRetryStage(i Integration, groupName string) *RetryStage
NewRetryStage returns a new instance of a RetryStage.
type RoutingStage ¶ added in v0.5.0
RoutingStage executes the inner stages based on the receiver specified in the context.
func BuildPipeline ¶ added in v0.5.0
func BuildPipeline( confs []*config.Receiver, tmpl *template.Template, wait func() time.Duration, muter types.Muter, silences *silence.Silences, notificationLog NotificationLog, marker types.Marker, peer *cluster.Peer, logger log.Logger, ) RoutingStage
BuildPipeline builds a map of receivers to Stages.
type SetNotifiesStage ¶ added in v0.5.0
type SetNotifiesStage struct {
// contains filtered or unexported fields
}
SetNotifiesStage sets the notification information about passed alerts. The passed alerts should have already been sent to the receivers.
func NewSetNotifiesStage ¶ added in v0.5.0
func NewSetNotifiesStage(l NotificationLog, recv *nflogpb.Receiver) *SetNotifiesStage
NewSetNotifiesStage returns a new instance of a SetNotifiesStage.
type SilenceStage ¶ added in v0.5.0
type SilenceStage struct {
// contains filtered or unexported fields
}
SilenceStage filters alerts through a silence muter.
func NewSilenceStage ¶ added in v0.5.0
func NewSilenceStage(s *silence.Silences, mk types.Marker) *SilenceStage
NewSilenceStage returns a new SilenceStage.
type Slack ¶
type Slack struct {
// contains filtered or unexported fields
}
Slack implements a Notifier for Slack notifications.
type Stage ¶ added in v0.5.0
type Stage interface {
Exec(ctx context.Context, l log.Logger, alerts ...*types.Alert) (context.Context, []*types.Alert, error)
}
A Stage processes alerts under the constraints of the given context.
type StageFunc ¶ added in v0.5.0
type StageFunc func(ctx context.Context, l log.Logger, alerts ...*types.Alert) (context.Context, []*types.Alert, error)
StageFunc wraps a function to represent a Stage.
type VictorOps ¶ added in v0.5.0
type VictorOps struct {
// contains filtered or unexported fields
}
VictorOps implements a Notifier for VictorOps notifications.
func NewVictorOps ¶ added in v0.5.0
NewVictorOps returns a new VictorOps notifier.
type WaitStage ¶ added in v0.5.0
type WaitStage struct {
// contains filtered or unexported fields
}
WaitStage waits for a certain amount of time before continuing or until the context is done.
func NewWaitStage ¶ added in v0.5.0
NewWaitStage returns a new WaitStage.
type Webhook ¶
type Webhook struct {
// contains filtered or unexported fields
}
Webhook implements a Notifier for generic webhooks.
func NewWebhook ¶
NewWebhook returns a new Webhook.
type WebhookMessage ¶
type WebhookMessage struct { *template.Data // The protocol version. Version string `json:"version"` GroupKey string `json:"groupKey"` }
WebhookMessage defines the JSON object send to webhook endpoints.
type Wechat ¶ added in v0.12.0
type Wechat struct {
// contains filtered or unexported fields
}
Wechat implements a Notfier for wechat notifications
type WechatToken ¶ added in v0.12.0
type WechatToken struct {
AccessToken string `json:"access_token"`
}
Wechat AccessToken with corpid and corpsecret.