Documentation
¶
Overview ¶
Package alert 提供 webhook 告警通知功能。
Index ¶
Constants ¶
View Source
const ( EventQuotaExceeded = "quota_exceeded" // token 配额超限 EventRateLimited = "rate_limited" // 请求频率超限 EventNodeDown = "node_down" // 集群节点下线 EventNodeRecovered = "node_recovered" // 集群节点恢复 )
告警事件类型常量
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct {
Kind string `json:"kind"` // 事件类型(见上方常量)
At time.Time `json:"at"` // 事件发生时间
Message string `json:"message"` // 可读描述
Labels map[string]string `json:"labels,omitempty"` // 附加标签(user_id 等)
}
Event 告警事件
type Notifier ¶
type Notifier struct {
// contains filtered or unexported fields
}
Notifier 向 webhook URL 异步发送告警事件。 webhookURL 为空时所有操作均为 no-op。
func NewNotifier ¶
NewNotifier 创建 Notifier。 webhookURL 为空时返回静默(no-op)的 Notifier。
Click to show internal directories.
Click to hide internal directories.