public void UpdatePerOperationSampler_ShouldCreateNewPerOpSampler_WhenSamplerIsNotAlreadyPerOp() { var strategies = new PerOperationSamplingStrategies { DefaultSamplingProbability = 0.5, DefaultLowerBoundTracesPerSecond = 10, PerOperationStrategies = new List <OperationSamplingStrategy>() }; _testingSampler.UpdatePerOperationSampler(strategies); _mockMetrics.Received(0).SamplerUpdated.Inc(Arg.Is <long>(d => d == 1)); _mockSamplerFactory.Received(1).NewPerOperationSampler( Arg.Is <int>(mo => mo == 2000), Arg.Is <double>(dsp => dsp == strategies.DefaultSamplingProbability), Arg.Is <double>(dlbtps => dlbtps == strategies.DefaultLowerBoundTracesPerSecond), Arg.Is <ILoggerFactory>(lf => lf == _mockLoggerFactory)); }
public void PerOperationSampler_Dispose() { _testingSampler.IsSampled(new TraceId(1), "op1"); _testingSampler.IsSampled(new TraceId(1), "op2"); _testingSampler.Dispose(); _mockSamplerFactory.Received(2).NewGuaranteedThroughputProbabilisticSampler(Arg.Any <double>(), Arg.Any <double>()); _mockGtpSampler.Received(2).Dispose(); _mockDefaultSampler.Received(1).Dispose(); }