pub struct N1DetectionConfig {
pub threshold: u64,
pub enabled: bool,
}Expand description
N+1 检测配置
Fields§
§threshold: u64触发告警的查询次数阈值(同一 relation 在一个窗口内的单条查询次数 ≥ threshold)
enabled: bool是否启用检测(false 时所有 record_* 调用均为 no-op)
Implementations§
Source§impl N1DetectionConfig
impl N1DetectionConfig
Sourcepub fn new() -> N1DetectionConfig
pub fn new() -> N1DetectionConfig
创建默认配置(threshold=5, enabled=true)
Sourcepub fn with_threshold(self, threshold: u64) -> N1DetectionConfig
pub fn with_threshold(self, threshold: u64) -> N1DetectionConfig
自定义阈值
Sourcepub fn with_enabled(self, enabled: bool) -> N1DetectionConfig
pub fn with_enabled(self, enabled: bool) -> N1DetectionConfig
启用/禁用
Trait Implementations§
Source§impl Clone for N1DetectionConfig
impl Clone for N1DetectionConfig
Source§fn clone(&self) -> N1DetectionConfig
fn clone(&self) -> N1DetectionConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for N1DetectionConfig
impl Debug for N1DetectionConfig
Source§impl Default for N1DetectionConfig
impl Default for N1DetectionConfig
Source§fn default() -> N1DetectionConfig
fn default() -> N1DetectionConfig
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for N1DetectionConfig
impl RefUnwindSafe for N1DetectionConfig
impl Send for N1DetectionConfig
impl Sync for N1DetectionConfig
impl Unpin for N1DetectionConfig
impl UnsafeUnpin for N1DetectionConfig
impl UnwindSafe for N1DetectionConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more