Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlertNotification ¶ added in v1.2.0
type AlertNotification struct {
AlertID models.AlertID
AlertName string
Description string
Status models.AlertStatus
Severity models.AlertSeverity
TeamID models.TeamID
TeamName string
SourceID models.SourceID
SourceName string
Value float64
ThresholdOp models.AlertThresholdOperator
ThresholdValue float64
FrequencySecs int
LookbackSecs int
Query string
ConditionJSON string
Labels map[string]string
Annotations map[string]string
TriggeredAt time.Time
ResolvedAt *time.Time
GeneratorURL string
Message string
RecipientUserIDs []models.UserID
RecipientEmails []string
MissingRecipientUserIDs []models.UserID
RecipientResolutionErr string
WebhookURLs []string
}
AlertNotification represents a fully resolved notification payload ready for delivery.
type AlertSender ¶
type AlertSender interface {
Send(ctx context.Context, notification AlertNotification) error
}
AlertSender abstracts the delivery mechanism for alert notifications.
func NewMultiSender ¶ added in v1.2.0
func NewMultiSender(senders ...AlertSender) AlertSender
type DynamicEmailSender ¶ added in v1.2.0
type DynamicEmailSender struct {
// contains filtered or unexported fields
}
func NewDynamicEmailSender ¶ added in v1.2.0
func NewDynamicEmailSender(settings SettingsReader, logger *slog.Logger) *DynamicEmailSender
func (*DynamicEmailSender) Send ¶ added in v1.2.0
func (d *DynamicEmailSender) Send(ctx context.Context, notification AlertNotification) error
type DynamicWebhookSender ¶ added in v1.2.0
type DynamicWebhookSender struct {
// contains filtered or unexported fields
}
func NewDynamicWebhookSender ¶ added in v1.2.0
func NewDynamicWebhookSender(settings SettingsReader, logger *slog.Logger) *DynamicWebhookSender
func (*DynamicWebhookSender) Send ¶ added in v1.2.0
func (d *DynamicWebhookSender) Send(ctx context.Context, notification AlertNotification) error
type EmailSender ¶ added in v1.2.0
type EmailSender struct {
// contains filtered or unexported fields
}
func NewEmailSender ¶ added in v1.2.0
func NewEmailSender(opts EmailSenderOptions) *EmailSender
func (*EmailSender) Send ¶ added in v1.2.0
func (s *EmailSender) Send(ctx context.Context, notification AlertNotification) error
type EmailSenderOptions ¶ added in v1.2.0
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager coordinates alert evaluation and dispatches notifications when thresholds are met.
func NewManager ¶
NewManager constructs a new alert manager instance.
func (*Manager) ManualResolve ¶
type MultiSender ¶ added in v1.2.0
type MultiSender struct {
// contains filtered or unexported fields
}
func (MultiSender) Send ¶ added in v1.2.0
func (m MultiSender) Send(ctx context.Context, notification AlertNotification) error
type Options ¶
type Options struct {
Config config.AlertsConfig
DB *sqlite.DB
ClickHouse *clickhouse.Manager
Logger *slog.Logger
Sender AlertSender
}
Options encapsulates the dependencies required to run the alerting manager.
type SettingsReader ¶ added in v1.2.0
type SettingsReader interface {
GetSettingWithDefault(ctx context.Context, key, defaultValue string) string
GetIntSetting(ctx context.Context, key string, defaultValue int) int
GetBoolSetting(ctx context.Context, key string, defaultValue bool) bool
GetDurationSetting(ctx context.Context, key string, defaultValue time.Duration) time.Duration
}
type WebhookSender ¶ added in v1.2.0
type WebhookSender struct {
// contains filtered or unexported fields
}
func NewWebhookSender ¶ added in v1.2.0
func NewWebhookSender(opts WebhookSenderOptions) *WebhookSender
func (*WebhookSender) Send ¶ added in v1.2.0
func (s *WebhookSender) Send(ctx context.Context, notification AlertNotification) error
Click to show internal directories.
Click to hide internal directories.