Struct elfo_core::tracing::TraceIdValidator
source · pub struct TraceIdValidator { /* private fields */ }
Expand description
A TraceId
validator.
By default, it checks the following properties:
- Cannot be zero.
- Must be 63-bit.
- Cannot have the same node no, because it’s sent outside the elfo system.
Optionally, it can also check the time difference, see
TraceIdValidator::max_time_difference
.
Implementations§
source§impl TraceIdValidator
impl TraceIdValidator
sourcepub fn max_time_difference(
&mut self,
time_lag: impl Into<Option<Duration>>
) -> Self
pub fn max_time_difference( &mut self, time_lag: impl Into<Option<Duration>> ) -> Self
Allowed time difference between now and timestamp in a raw trace id. Checks the absolute difference to handle both situations:
- Too old timestamp, possible incorrectly generated.
- Too new timestamp, something wrong with time synchronization.
Trait Implementations§
source§impl Clone for TraceIdValidator
impl Clone for TraceIdValidator
source§fn clone(&self) -> TraceIdValidator
fn clone(&self) -> TraceIdValidator
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Default for TraceIdValidator
impl Default for TraceIdValidator
source§fn default() -> TraceIdValidator
fn default() -> TraceIdValidator
Returns the “default value” for a type. Read more