pub struct MetricsConfig {
pub enable_backpressure: bool,
pub enable_batch: bool,
pub sample_rate: u32,
}Expand description
Performance metrics configuration
Controls emission of observability metrics. Disabling metrics reduces overhead in hot paths but decreases system visibility.
§Example
[raft.metrics]
enable_backpressure = true
enable_batch = true
sample_rate = 1 # No sampling (record every event)Fields§
§enable_backpressure: boolEnable backpressure metrics (rejections, buffer utilization)
Tracks client request backpressure for capacity planning. Disable for absolute maximum performance in trusted environments.
Default: false
enable_batch: boolEnable buffer length gauge (batch.buffer_length for propose and linearizable buffers)
Tracks buffer utilization for capacity planning. Disable for absolute maximum performance in trusted environments.
Default: false
sample_rate: u32Sample rate for high-frequency gauge metrics
1= record every event (no sampling)10= record 1 out of 10 events (10% sampling)100= record 1 out of 100 events (1% sampling)
Applies to: buffer_utilization, buffer_length gauges. Does NOT apply to: counters (rejections, drain/heartbeat triggers).
Default: 1 (no sampling)
Trait Implementations§
Source§impl Clone for MetricsConfig
impl Clone for MetricsConfig
Source§fn clone(&self) -> MetricsConfig
fn clone(&self) -> MetricsConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MetricsConfig
impl Debug for MetricsConfig
Source§impl Default for MetricsConfig
impl Default for MetricsConfig
Source§impl<'de> Deserialize<'de> for MetricsConfig
impl<'de> Deserialize<'de> for MetricsConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for MetricsConfig
impl RefUnwindSafe for MetricsConfig
impl Send for MetricsConfig
impl Sync for MetricsConfig
impl Unpin for MetricsConfig
impl UnsafeUnpin for MetricsConfig
impl UnwindSafe for MetricsConfig
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
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request