track_new_sampled

Function track_new_sampled 

Source
pub fn track_new_sampled<T>(name: &str, value: T, sample_rate: f64) -> T
Expand description

Track variable creation with sampling. Only records the event if the sample check passes. Returns the value unchanged regardless of sampling.

§Arguments

  • name - Variable name
  • value - The value being tracked
  • sample_rate - Probability of tracking (0.0 to 1.0)

§Examples

// Track only ~10% of calls
let x = track_new_sampled("x", 42, 0.1);