pub struct TelemetryConfig {
pub service_name: String,
pub enable_query_span: bool,
pub enable_pool_span: bool,
pub sample_rate: f64,
}Expand description
遥测配置
Fields§
§service_name: String服务名(用于 span 属性 service.name)
enable_query_span: bool是否启用查询 span(默认 true)
enable_pool_span: bool是否连接池 span(默认 true)
sample_rate: f64采样率(0.0 ~ 1.0,1.0 = 全采样,默认 1.0)
Implementations§
Source§impl TelemetryConfig
impl TelemetryConfig
Sourcepub fn with_sample_rate(self, rate: f64) -> Self
pub fn with_sample_rate(self, rate: f64) -> Self
设置采样率(自动限制在 0.0 ~ 1.0)
Sourcepub fn with_query_span(self, enabled: bool) -> Self
pub fn with_query_span(self, enabled: bool) -> Self
设置是否启用查询 span
Sourcepub fn with_pool_span(self, enabled: bool) -> Self
pub fn with_pool_span(self, enabled: bool) -> Self
设置是否启用连接池 span
Trait Implementations§
Source§impl Clone for TelemetryConfig
impl Clone for TelemetryConfig
Source§fn clone(&self) -> TelemetryConfig
fn clone(&self) -> TelemetryConfig
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 TelemetryConfig
impl Debug for TelemetryConfig
Auto Trait Implementations§
impl Freeze for TelemetryConfig
impl RefUnwindSafe for TelemetryConfig
impl Send for TelemetryConfig
impl Sync for TelemetryConfig
impl Unpin for TelemetryConfig
impl UnsafeUnpin for TelemetryConfig
impl UnwindSafe for TelemetryConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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