public ShouldSend ( double sampleRate ) : bool | ||
sampleRate | double | |
return | bool |
public bool ShouldSend(double sampleRate)
{
return Random.NextDouble() < sampleRate;
}
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)); } }