use of io.jaegertracing.spi.Sampler in project jaeger-client-java by jaegertracing.
the class RemoteControlledSamplerTest method testUpdateToPerOperationSamplerReplacesProbabilisticSampler.
@Test
public void testUpdateToPerOperationSamplerReplacesProbabilisticSampler() throws Exception {
List<PerOperationSamplingParameters> operationToSampler = new ArrayList<>();
operationToSampler.add(new PerOperationSamplingParameters("operation", new ProbabilisticSamplingStrategy(0.1)));
OperationSamplingParameters parameters = new OperationSamplingParameters(0.11, 0.22, operationToSampler);
SamplingStrategyResponse response = new SamplingStrategyResponse(null, null, parameters);
when(samplingManager.getSamplingStrategy(SERVICE_NAME)).thenReturn(response);
undertest.updateSampler();
PerOperationSampler perOperationSampler = new PerOperationSampler(2000, parameters);
Sampler actualSampler = undertest.getSampler();
assertEquals(perOperationSampler, actualSampler);
}
use of io.jaegertracing.spi.Sampler in project jaeger-client-java by jaegertracing.
the class ProbabilisticSamplerTest method testSamplingBoundariesPositive.
@Test
public void testSamplingBoundariesPositive() {
double samplingRate = 0.5;
long halfwayBoundary = 0x3fffffffffffffffL;
Sampler sampler = new ProbabilisticSampler(samplingRate);
assertTrue(sampler.sample("", halfwayBoundary).isSampled());
assertFalse(sampler.sample("", halfwayBoundary + 2).isSampled());
}
Aggregations