Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidAlertGroup will be used when the alertgroup is not valid. ErrInvalidAlertGroup = errors.New("invalid alert group") )
Functions ¶
This section is empty.
Types ¶
type Notification ¶ added in v0.2.0
type Notification struct { // ChatID is an ID to send the notification. In // Telegram could be a channel/group ID, in Slack // a room or a user. ChatID string AlertGroup model.AlertGroup }
Notification is the notification that wants to be send via a notifier.
type Notifier ¶
type Notifier interface { Notify(ctx context.Context, notification Notification) error Type() string }
Notifier knows how to notify alerts to different backends.
func NewMeasureNotifier ¶
func NewMeasureNotifier(rec NotifierMetricsRecorder, next Notifier) Notifier
NewMeasureNotifier wraps a notifier and measures using metrics.
type NotifierMetricsRecorder ¶
type NotifierMetricsRecorder interface {
ObserveForwardNotifierOpDuration(ctx context.Context, notifierType string, op string, success bool, t time.Duration)
}
NotifierMetricsRecorder knows how to record metrics on forward.Notifier.
type Properties ¶ added in v0.2.0
type Properties struct { // CustomChatID can be used when the forward should be done // to a different target (chat, group, channel, user...) // instead of using the default one. CustomChatID string }
Properties are the properties an AlertGroup can have when the forwarding process is done.
type Service ¶
type Service interface { // Forward knows how to forward alerts from an input to an output. Forward(ctx context.Context, props Properties, alertGroup *model.AlertGroup) error }
Service is the domain service that forwards alerts
func NewMeasureService ¶
func NewMeasureService(rec ServiceMetricsRecorder, next Service) Service
NewMeasureService wraps a service and measures using metrics.
func NewService ¶
func NewService(cfg ServiceConfig) (Service, error)
NewService returns a new forward.Service.
type ServiceConfig ¶ added in v0.3.0
ServiceConfig is the service configuration.
Click to show internal directories.
Click to hide internal directories.