alerts

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alerter

type Alerter interface {
	Alert(payload []byte, memo string) error
	Name() string
}

Alerter is an interface that defines a generic alerting hook.

func CreateAlerters

func CreateAlerters(cfg config.Config, logger core.Logger) []Alerter

CreateAlerters creates the core series of alerting components used to alert a client with a monitor triggers an event.

type SendGridAlerter

type SendGridAlerter struct {
	// contains filtered or unexported fields
}

SendGridAlerter implements an Alerter interface via the SendGrid API. It is responsible for sending alerts to given recipient email and SMS addresses.

func NewSendGridAlerter

func NewSendGridAlerter(logger core.Logger, apiKey, fromName string, recipients []string) SendGridAlerter

NewSendGridAlerter returns a new SendGridAlerter.

func (SendGridAlerter) Alert

func (sga SendGridAlerter) Alert(payload []byte, memo string) error

Alert implements the Alerter interface. It will send an email (or SMS message) with a given payload (body) to a series of recipients. If any send fails, an error will be immediately returned.

TODO: Investigate parallelizing sending messages.

func (SendGridAlerter) AlertWithRecipients

func (sga SendGridAlerter) AlertWithRecipients(payload []byte, memo string, recipients []string) error

AlertWithRecipients attempts to send a message to a series of recipients via the SendGrid API. If any send fails, an error will be immediately returned.

TODO: Investigate parallelizing sending messages.

func (SendGridAlerter) Name added in v0.0.2

func (sga SendGridAlerter) Name() string

Name implements the Alerter interface. It returns the name of the alerter.

Jump to

Keyboard shortcuts

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