pub struct InMemoryAlertHook { /* private fields */ }Expand description
内存告警钩子(非真实 Webhook):将告警存入内存,不进行任何网络发送。
类型名刻意改为 InMemoryAlertHook(原 WebhookAlertHook 名字暗示 HTTP 调用,
但实际只 push 到 Vec,会误导用户)。identifier 字段仅用于测试断言与调试,
不会被用于任何 HTTP 请求。
如需真实 Webhook 推送,请实现自定义 AlertHook 并在 notify 中使用
reqwest 或 hyper 发起 HTTP 请求。
用于测试和本地开发环境,可通过 sent_alerts
检查被分发过的告警。
Implementations§
Source§impl InMemoryAlertHook
impl InMemoryAlertHook
Sourcepub fn sent_alerts(&self) -> Vec<Alert>
pub fn sent_alerts(&self) -> Vec<Alert>
返回到目前为止已“发送“的告警快照(拷贝)。
Sourcepub fn identifier(&self) -> &str
pub fn identifier(&self) -> &str
暴露配置的标识符,便于调用方调试或断言。
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for InMemoryAlertHook
impl RefUnwindSafe for InMemoryAlertHook
impl Send for InMemoryAlertHook
impl Sync for InMemoryAlertHook
impl Unpin for InMemoryAlertHook
impl UnsafeUnpin for InMemoryAlertHook
impl UnwindSafe for InMemoryAlertHook
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more