Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnrichEvent ¶
func EnrichEvent(event *AlertEvent)
Types ¶
type AlertEvent ¶
type AlertEvent struct {
AppName string
AppSlug string
Metric string
MetricDisplay string // human-friendly metric name
Value float64
ValueDisplay string // human-friendly value (e.g. "26.3 GB")
Threshold float64
ThresholdDisplay string // human-friendly threshold
Operator string
Status string // "firing", "resolved"
FiredAt time.Time
}
type AlertStoreReader ¶
type AlertStoreReader interface {
ListActiveAlertRules() ([]store.AlertRule, error)
GetActiveAlert(ruleID int64) (*store.AlertHistory, error)
CreateAlertHistory(ruleID int64, value float64, rule *store.AlertRule) (*store.AlertHistory, error)
ResolveAlert(historyID int64) error
GetWebhook(id int64) (*store.Webhook, error)
}
type BackupAlertEvent ¶
type BackupAlertEvent struct {
AppName string
Strategy string
Message string
EventType string // "backup_failed" or "backup_missed"
FiredAt time.Time
}
BackupAlertEvent represents a backup-related alert.
func (BackupAlertEvent) ToAlertEvent ¶
func (b BackupAlertEvent) ToAlertEvent() AlertEvent
type Evaluator ¶
type Evaluator struct {
// contains filtered or unexported fields
}
func NewEvaluator ¶
func NewEvaluator(s AlertStoreReader, appLookup AppLookup, mq MetricQuerier, dispatcher *WebhookDispatcher) *Evaluator
func (*Evaluator) DispatchBackupAlert ¶
func (e *Evaluator) DispatchBackupAlert(event BackupAlertEvent)
DispatchBackupAlert sends a backup alert to all matching webhooks.
type MetricQuerier ¶
type WebhookDispatcher ¶
type WebhookDispatcher struct {
// contains filtered or unexported fields
}
func NewWebhookDispatcher ¶
func NewWebhookDispatcher() *WebhookDispatcher
func NewWebhookDispatcherAllowPrivate ¶
func NewWebhookDispatcherAllowPrivate() *WebhookDispatcher
NewWebhookDispatcherAllowPrivate creates a dispatcher that skips SSRF checks (for testing).
func (*WebhookDispatcher) Send ¶
func (d *WebhookDispatcher) Send(webhook store.Webhook, event AlertEvent) error
Click to show internal directories.
Click to hide internal directories.