push

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 4, 2026 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dispatcher

type Dispatcher interface {
	Dispatch(ctx context.Context, ev *event.Event)
}

Dispatcher 告警事件分发接口,供 event.Core 依赖注入使用

type Notifier

type Notifier struct {
	// contains filtered or unexported fields
}

Notifier 将告警事件异步推送到多个 webhook 目标 每个目标独立维护一个 buffered channel 和一个 worker goroutine,互不阻塞

func NewNotifier

func NewNotifier(targets []string, maxRetry, bufferSize int) *Notifier

NewNotifier 创建 Notifier,为每个 target 启动独立的 worker goroutine target URL 中的 ?secret=xxx 会被提取放入 Secret header 发送,URL 本身不携带 secret

func (*Notifier) Close

func (n *Notifier) Close()

Close 关闭所有 worker channel,等待剩余事件处理后退出

func (*Notifier) Dispatch

func (n *Notifier) Dispatch(ctx context.Context, ev *event.Event)

Dispatch 非阻塞地将事件投递到每个 target 的缓冲队列 若队列已满则丢弃并记录警告,不阻塞调用方

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL