Documentation
¶
Index ¶
- type AlertStorage
- type ChannelDispatcher
- type DiscordDispatcher
- type EmailDispatcher
- type Manager
- func (m *Manager) AcknowledgeIncident(incidentID, userID string) error
- func (m *Manager) DeleteChannel(id string) error
- func (m *Manager) DeleteRule(id string) error
- func (m *Manager) GetChannel(id string) (*core.AlertChannel, error)
- func (m *Manager) GetRule(id string) (*core.AlertRule, error)
- func (m *Manager) GetStats() core.AlertManagerStats
- func (m *Manager) ListActiveIncidents() []*core.Incident
- func (m *Manager) ListChannels() []*core.AlertChannel
- func (m *Manager) ListRules() []*core.AlertRule
- func (m *Manager) ProcessJudgment(soul *core.Soul, prevStatus core.SoulStatus, judgment *core.Judgment)
- func (m *Manager) RegisterChannel(channel *core.AlertChannel) error
- func (m *Manager) RegisterRule(rule *core.AlertRule) error
- func (m *Manager) ResolveIncident(incidentID, userID string) error
- func (m *Manager) Start() error
- func (m *Manager) Stop() error
- type NtfyDispatcher
- type OpsGenieDispatcher
- type PagerDutyDispatcher
- type SMSDispatcher
- type SlackDispatcher
- type TelegramDispatcher
- type WebHookDispatcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlertStorage ¶
type AlertStorage interface {
SaveChannel(channel *core.AlertChannel) error
GetChannel(id string) (*core.AlertChannel, error)
ListChannels() ([]*core.AlertChannel, error)
DeleteChannel(id string) error
SaveRule(rule *core.AlertRule) error
GetRule(id string) (*core.AlertRule, error)
ListRules() ([]*core.AlertRule, error)
DeleteRule(id string) error
SaveEvent(event *core.AlertEvent) error
ListEvents(soulID string, limit int) ([]*core.AlertEvent, error)
SaveIncident(incident *core.Incident) error
GetIncident(id string) (*core.Incident, error)
ListActiveIncidents() ([]*core.Incident, error)
}
AlertStorage persists alert data
type ChannelDispatcher ¶
type ChannelDispatcher interface {
Send(ctx context.Context, event *core.AlertEvent, channel *core.AlertChannel) error
Validate(config map[string]any) error
}
ChannelDispatcher sends notifications to a specific channel type
type DiscordDispatcher ¶
type DiscordDispatcher struct {
// contains filtered or unexported fields
}
DiscordDispatcher sends alerts to Discord via webhooks
func (*DiscordDispatcher) Send ¶
func (d *DiscordDispatcher) Send(ctx context.Context, event *core.AlertEvent, channel *core.AlertChannel) error
Send sends an alert to Discord
type EmailDispatcher ¶
type EmailDispatcher struct {
// contains filtered or unexported fields
}
EmailDispatcher sends alerts via SMTP
func (*EmailDispatcher) Send ¶
func (d *EmailDispatcher) Send(ctx context.Context, event *core.AlertEvent, channel *core.AlertChannel) error
Send sends an email alert
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles alert routing and delivery The high priest who receives omens and dispatches messengers
func NewManager ¶
func NewManager(storage AlertStorage, logger *slog.Logger) *Manager
NewManager creates a new alert manager
func (*Manager) AcknowledgeIncident ¶
AcknowledgeIncident acknowledges an incident
func (*Manager) DeleteChannel ¶
DeleteChannel removes an alert channel
func (*Manager) DeleteRule ¶
DeleteRule removes an alert rule
func (*Manager) GetChannel ¶
func (m *Manager) GetChannel(id string) (*core.AlertChannel, error)
GetChannel returns a channel by ID
func (*Manager) GetStats ¶
func (m *Manager) GetStats() core.AlertManagerStats
GetStats returns alert manager statistics
func (*Manager) ListActiveIncidents ¶
ListActiveIncidents returns active incidents
func (*Manager) ListChannels ¶
func (m *Manager) ListChannels() []*core.AlertChannel
ListChannels returns all registered channels
func (*Manager) ProcessJudgment ¶
func (m *Manager) ProcessJudgment(soul *core.Soul, prevStatus core.SoulStatus, judgment *core.Judgment)
ProcessJudgment evaluates a judgment against alert rules
func (*Manager) RegisterChannel ¶
func (m *Manager) RegisterChannel(channel *core.AlertChannel) error
RegisterChannel adds or updates an alert channel
func (*Manager) RegisterRule ¶
RegisterRule adds or updates an alert rule
func (*Manager) ResolveIncident ¶
ResolveIncident marks an incident as resolved
type NtfyDispatcher ¶
type NtfyDispatcher struct {
// contains filtered or unexported fields
}
NtfyDispatcher sends alerts to Ntfy
func (*NtfyDispatcher) Send ¶
func (d *NtfyDispatcher) Send(ctx context.Context, event *core.AlertEvent, channel *core.AlertChannel) error
Send sends an alert to Ntfy
type OpsGenieDispatcher ¶
type OpsGenieDispatcher struct {
// contains filtered or unexported fields
}
OpsGenieDispatcher sends alerts to OpsGenie
func (*OpsGenieDispatcher) Send ¶
func (d *OpsGenieDispatcher) Send(ctx context.Context, event *core.AlertEvent, channel *core.AlertChannel) error
Send sends an alert to OpsGenie
type PagerDutyDispatcher ¶
type PagerDutyDispatcher struct {
// contains filtered or unexported fields
}
PagerDutyDispatcher sends alerts to PagerDuty
func (*PagerDutyDispatcher) Send ¶
func (d *PagerDutyDispatcher) Send(ctx context.Context, event *core.AlertEvent, channel *core.AlertChannel) error
Send sends an alert to PagerDuty
type SMSDispatcher ¶
type SMSDispatcher struct {
// contains filtered or unexported fields
}
SMSDispatcher sends alerts via SMS (Twilio/Vonage)
func (*SMSDispatcher) Send ¶
func (d *SMSDispatcher) Send(ctx context.Context, event *core.AlertEvent, channel *core.AlertChannel) error
Send sends an SMS alert
type SlackDispatcher ¶
type SlackDispatcher struct {
// contains filtered or unexported fields
}
SlackDispatcher sends alerts to Slack via webhooks
func (*SlackDispatcher) Send ¶
func (d *SlackDispatcher) Send(ctx context.Context, event *core.AlertEvent, channel *core.AlertChannel) error
Send sends an alert to Slack
type TelegramDispatcher ¶
type TelegramDispatcher struct {
// contains filtered or unexported fields
}
TelegramDispatcher sends alerts to Telegram
func (*TelegramDispatcher) Send ¶
func (d *TelegramDispatcher) Send(ctx context.Context, event *core.AlertEvent, channel *core.AlertChannel) error
Send sends an alert to Telegram
type WebHookDispatcher ¶
type WebHookDispatcher struct {
// contains filtered or unexported fields
}
WebHookDispatcher sends alerts to generic webhooks
func (*WebHookDispatcher) Send ¶
func (d *WebHookDispatcher) Send(ctx context.Context, event *core.AlertEvent, channel *core.AlertChannel) error
Send sends an alert to a webhook