internal GuaranteedThroughputProbabilisticSampler(IProbabilisticSampler probabilisticSampler, IRateLimitingSampler rateLimitingSampler) { _probabilisticSampler = probabilisticSampler; _rateLimitingSampler = rateLimitingSampler; _tags = new Dictionary <string, object> { { SamplerConstants.SamplerTypeTagKey, SamplerConstants.SamplerTypeLowerBound }, { SamplerConstants.SamplerParamTagKey, _probabilisticSampler.SamplingRate } }; }
public bool Update(double samplingRate, double lowerBound) { var isUpdated = false; if (Math.Abs(samplingRate - _probabilisticSampler.SamplingRate) > double.Epsilon) { _probabilisticSampler = new ProbabilisticSampler(samplingRate); _tags[SamplerConstants.SamplerParamTagKey] = samplingRate; isUpdated = true; } if (Math.Abs(lowerBound - _rateLimitingSampler.MaxTracesPerSecond) > double.Epsilon) { _rateLimitingSampler = new RateLimitingSampler(lowerBound); isUpdated = true; } return(isUpdated); }