forward

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

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 Notifier

type Notifier interface {
	Notify(ctx context.Context, alertGroup *model.AlertGroup) 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 Service

type Service interface {
	// Forward knows how to forward alerts from an input to an output.
	Forward(ctx context.Context, 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(notifiers []Notifier, l log.Logger) Service

NewService returns a new forward.Service.

type ServiceMetricsRecorder

type ServiceMetricsRecorder interface {
	ObserveForwardServiceOpDuration(ctx context.Context, op string, success bool, t time.Duration)
}

ServiceMetricsRecorder knows how to record metrics on forward.Service.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL