StatsdClient.RandomGenerator.ShouldSend C# (CSharp) Method

ShouldSend() public method

public ShouldSend ( double sampleRate ) : bool
sampleRate double
return bool
        public bool ShouldSend(double sampleRate)
        {
            return Random.NextDouble() < sampleRate;
        }

Usage Example

Ejemplo n.º 1
0
 public void Send <TCommandType, T>(string name, T value, double sampleRate = 1.0, string[] tags = null) where TCommandType : Metric
 {
     if (RandomGenerator.ShouldSend(sampleRate))
     {
         Send(Metric.GetCommand <TCommandType, T>(_prefix, name, value, sampleRate, tags));
     }
 }
All Usage Examples Of StatsdClient.RandomGenerator::ShouldSend
RandomGenerator