Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlertPayload ¶
type PagerDuty ¶
type PagerDuty struct {
// contains filtered or unexported fields
}
func (*PagerDuty) SendAlert ¶
func (p *PagerDuty) SendAlert(data *AlertPayload) error
SendAlert sends an alert to PagerDuty with the provided payload data. It creates a PDData struct with the provided routing key, event action and payload. It creates an HTTP POST request with the PagerDuty event URL as the endpoint and the marshaled JSON data as the request body. It sends the request using an HTTP client with a maximum of 5 retries for network errors with exponential backoff before each retry. It handles different HTTP response status codes and returns an error based on the status code(). If all retries fail, it returns an error indicating the last network error encountered.
type Plugin ¶
type Plugin interface {
SendAlert(data *AlertPayload) error
}
func LoadAlertPlugins ¶
func LoadAlertPlugins(cfg config.CurioAlertingConfig) []Plugin
func NewPagerDuty ¶
func NewPagerDuty(cfg config.PagerDutyConfig) Plugin
func NewPrometheusAlertManager ¶
func NewPrometheusAlertManager(cfg config.PrometheusAlertManagerConfig) Plugin
func NewSlackWebhook ¶ added in v1.23.0
func NewSlackWebhook(cfg config.SlackWebhookConfig) Plugin
type PrometheusAlertManager ¶
type PrometheusAlertManager struct {
// contains filtered or unexported fields
}
func (*PrometheusAlertManager) SendAlert ¶
func (p *PrometheusAlertManager) SendAlert(data *AlertPayload) error
SendAlert sends an alert to Prometheus AlertManager with the provided payload data. API reference: https://raw.githubusercontent.com/prometheus/alertmanager/main/api/v2/openapi.yaml
type SlackWebhook ¶ added in v1.23.0
type SlackWebhook struct {
// contains filtered or unexported fields
}
func (*SlackWebhook) SendAlert ¶ added in v1.23.0
func (s *SlackWebhook) SendAlert(data *AlertPayload) error
SendAlert sends an alert to SlackWebHook with the provided payload data. It creates a payload struct with the provided data. It creates an HTTP POST request with the SlackWebHook URL as the endpoint and the marshaled JSON data as the request body. It sends the request using an HTTP client with a maximum of 5 retries for network errors with exponential backoff before each retry. It handles different HTTP response status codes and returns an error based on the status code(). If all retries fail, it returns an error indicating the last network error encountered.