Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert struct { Message string Alias string Description string Actions []string Tags []string Entity string Priority Priority Responder []Responder VisibleTo []Responder // contains filtered or unexported fields }
Alert is the alert struct.
type AlertClient ¶
type AlertConfig ¶
type AlertContext ¶
AlertContext contains the alert execution context.
type DummyClient ¶
type DummyClient struct{}
DummyClient is a dummy alert client.
func NewDummyClient ¶
func NewDummyClient() *DummyClient
NewDummyClient creates a new dummy alert client.
func (*DummyClient) CreateAlert ¶
func (d *DummyClient) CreateAlert(key string, alertCtx AlertContext) (Alert, error)
NewDummyClient creates a new dummy alert client.
func (*DummyClient) CreateAndSend ¶
func (d *DummyClient) CreateAndSend(ctx context.Context, key string, alertCtx AlertContext) error
CreateAndSend creates an alert by key and alert context and sends it to opsgenie.
type OpsgenieClient ¶
type OpsgenieClient struct {
// contains filtered or unexported fields
}
OpsgenieClient is the alert client.
func NewAlertService ¶
func NewAlertService(cfg AlertConfig, registerAlertsFunc RegisterAlertsFunc) (*OpsgenieClient, error)
NewAlertService creates a new alert service
func (*OpsgenieClient) CreateAlert ¶
func (s *OpsgenieClient) CreateAlert(key string, alertCtx AlertContext) (Alert, error)
CreateAlert creates an alert by key and alert context. The key is the alert name, and with it we can get the alert from the registerd alerts. The alert context contains the alert execution data
func (*OpsgenieClient) CreateAndSend ¶
func (s *OpsgenieClient) CreateAndSend(ctx context.Context, key string, alertCtx AlertContext) error
CreateAndSend creates an alert by key and alert context and sends it to opsgenie.
type RegisterAlertsFunc ¶
type RegisterAlertsFunc func(cfg AlertConfig) map[string]Alert
RegisterAlertsFunc is the function that loads the alerts from the corresponding component.