alert

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeBlockFmt = "```%s```"

	// slackMsgFmt ... Slack message format
	SlackMsgFmt = `` /* 169-byte string literal not displayed */

)

TODO: add timestamp to the message Slack Formatting

View Source
const (
	PagerDutyMsgFmt = `
	Heuristic Triggered: %s
	Network: %s
	Assessment: 
	%s
	`
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v1.0.0

type Config struct {
	RoutingCfgPath          string
	PagerdutyAlertEventsURL string
	RoutingParams           *core.AlertRoutingParams
}

Config ... Alert manager configuration

type CoolDownHandler added in v1.0.0

type CoolDownHandler interface {
	Add(suuid core.SUUID, coolDownTime time.Duration)
	Update()
	IsCoolDown(suuid core.SUUID) bool
}

CoolDownHandler ... Interface for the cool down handler

func NewCoolDownHandler added in v1.0.0

func NewCoolDownHandler() CoolDownHandler

NewCoolDownHandler ... Initializer

type Interpolator

type Interpolator interface {
	InterpolateSlackMessage(sUUID core.SUUID, content string, msg string) string
	InterpolatePagerDutyMessage(sUUID core.SUUID, message string) string
}

Interpolator ... Interface for interpolating messages

func NewInterpolator

func NewInterpolator() Interpolator

NewInterpolator ... Initializer

type Manager

type Manager interface {
	AddSession(core.SUUID, *core.AlertPolicy) error
	Transit() chan core.Alert

	core.Subsystem
}

Manager ... Interface for alert manager

func NewManager

func NewManager(ctx context.Context, cfg *Config, cm RoutingDirectory) Manager

NewManager ... Instantiates a new alert manager

type RoutingDirectory added in v1.0.0

type RoutingDirectory interface {
	GetPagerDutyClients(sev core.Severity) []client.PagerDutyClient
	GetSlackClients(sev core.Severity) []client.SlackClient
	InitializeRouting(params *core.AlertRoutingParams)
	SetPagerDutyClients([]client.PagerDutyClient, core.Severity)
	SetSlackClients([]client.SlackClient, core.Severity)
}

RoutingDirectory ... Interface for routing directory

func NewRoutingDirectory added in v1.0.0

func NewRoutingDirectory(cfg *Config) RoutingDirectory

NewRoutingDirectory ... Instantiates a new routing directory

type Store

type Store interface {
	AddAlertPolicy(core.SUUID, *core.AlertPolicy) error
	GetAlertPolicy(sUUID core.SUUID) (*core.AlertPolicy, error)
}

Store ... Interface for alert policy store NOTE - This is a simple in-memory store, using this interface we can easily swap it out for a persistent store

func NewStore

func NewStore() Store

NewStore ... Initializer

Jump to

Keyboard shortcuts

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