Skip to main content

AlertHook

Trait AlertHook 

Source
pub trait AlertHook: Send + Sync {
    // Required method
    fn notify(&self, alert: &Alert) -> Result<(), String>;
}
Expand description

告警分发钩子。实现方可以将告警写入日志、发送到 Webhook、推送到 IM 等。

必须实现 Send + Sync 以便在多线程环境中作为 Arc<dyn AlertHook> 共享。

Required Methods§

Source

fn notify(&self, alert: &Alert) -> Result<(), String>

处理告警事件。成功返回 Ok(()),失败返回错误描述字符串。

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§