public void UpdatePerOperationSampler_ShouldUpdateParams_WhenSamplerIsAlreadyPerOp() { var perOpSampler = new PerOperationSampler(10, 0.5, 5, _mockLoggerFactory); _testingSampler = new RemoteControlledSampler( _serivceName, _mockSamplingManager, _mockLoggerFactory, _mockMetrics, perOpSampler, _mockSamplerFactory, _pollingIntervalMs, _mockPollTimer ); var strategies = new PerOperationSamplingStrategies { DefaultSamplingProbability = 0.5, DefaultLowerBoundTracesPerSecond = 10, PerOperationStrategies = new List <OperationSamplingStrategy>() }; _testingSampler.UpdatePerOperationSampler(strategies); _mockMetrics.Received(1).SamplerUpdated.Inc(Arg.Is <long>(d => d == 1)); }
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)); }