MonitoringConfig

Struct MonitoringConfig 

Source
pub struct MonitoringConfig {
    pub enabled: bool,
    pub sample_rate: usize,
    pub alert_threshold: f64,
    pub max_variation_percent: f64,
    pub timeout: Duration,
}
Expand description

Configuration for runtime cryptographic operation monitoring.

This struct controls how the monitoring system behaves, including sampling rates, alert thresholds, and performance constraints. Proper configuration balances security monitoring with production performance requirements.

§Security vs Performance Trade-offs

  • Higher sample rates: Better anomaly detection but increased overhead
  • Lower thresholds: More sensitive detection but higher false positives
  • Shorter timeouts: Faster failure detection but may flag legitimate operations
  • Development: High sample rate (1-10), low thresholds for testing
  • Production: Low sample rate (100-1000), balanced thresholds for monitoring
  • High-security: Medium sample rate (10-100), strict thresholds

§Fields

  • enabled: Master switch for all monitoring functionality
  • sample_rate: How often to monitor operations (1 = always, higher = less frequent)
  • alert_threshold: Statistical threshold for anomaly detection (in standard deviations)
  • max_variation_percent: Maximum allowed timing variation as percentage
  • timeout: Maximum allowed duration before timing out an operation

Fields§

§enabled: bool

Master enable switch for monitoring functionality

§sample_rate: usize

Sample rate for monitoring (1 = monitor every operation, higher values = less frequent) Lower values provide better coverage but increase performance overhead

§alert_threshold: f64

Statistical threshold for anomaly detection in standard deviations Values like 2.0-3.0 are typical for detecting significant deviations

§max_variation_percent: f64

Maximum allowed timing variation as a percentage of mean execution time Helps detect systems under load or environmental changes

§timeout: Duration

Maximum allowed duration for any monitored operation Operations exceeding this timeout trigger immediate alerts

Trait Implementations§

Source§

impl Clone for MonitoringConfig

Source§

fn clone(&self) -> MonitoringConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MonitoringConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MonitoringConfig

Source§

fn default() -> Self

Creates a default monitoring configuration optimized for production use.

The default configuration prioritizes performance while providing basic monitoring capabilities. Monitoring is disabled by default to avoid performance impact in production environments.

§Default Values
  • enabled: false - Monitoring disabled for performance
  • sample_rate: 1000 - Monitor 1 in 1000 operations
  • alert_threshold: 3.0 - Alert on 3-sigma deviations (99.7% confidence)
  • max_variation_percent: 10.0 - Allow 10% timing variation
  • timeout: 100ms - Operations should complete within 100 milliseconds
§Usage
use clock_curve_math::ct::monitoring::MonitoringConfig;

// Use defaults (monitoring disabled)
let config = MonitoringConfig::default();

// Enable monitoring for development
let dev_config = MonitoringConfig {
    enabled: true,
    sample_rate: 10, // Monitor more frequently
    ..MonitoringConfig::default()
};

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.