deadmansswitch

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const DisabledService = dummyService(0)

DisabledService is a Dead man switch service that doesn't do anything.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	CustomChatID string
	Interval     time.Duration
	Notifiers    []forward.Notifier
	Logger       log.Logger
}

Config is the Service configuration.

type Service

type Service interface {
	// PushSwitch will disable the dead man's switch when it's pushed and reset
	// the interval for activation.
	PushSwitch(ctx context.Context, alertGroup *model.AlertGroup) error
}

Service is a Dead man's switch

A dead man's switch is a process where at regular intervals if some kind of signal is not received it will be activated. This usually is used to check that some kind of system is working, in this case if we don't receive an alert we assume that something is not working and we should notify.

func NewMeasureService added in v0.2.1

func NewMeasureService(rec ServiceMetricsRecorder, next Service) Service

NewMeasureService wraps a service and measures using metrics.

func NewService

func NewService(ctx context.Context, cfg Config) (Service, error)

NewService returns a Dead mans's switch service. When creating a new instance it will start the dead man's switch interval it can only stop once and it's done when the received context is done.

type ServiceMetricsRecorder added in v0.2.1

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

ServiceMetricsRecorder knows how to record metrics on deadmansswitch.Service.

Jump to

Keyboard shortcuts

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