use of io.jaegertracing.internal.samplers.http.SamplingStrategyResponse in project jaeger-client-java by jaegertracing.
the class HttpSamplingManagerTest method testParsePerOperationSampling.
@Test
public void testParsePerOperationSampling() throws Exception {
SamplingStrategyResponse response = undertest.parseJson(readFixture("per_operation_sampling.json"));
OperationSamplingParameters actual = response.getOperationSampling();
assertEquals(0.001, actual.getDefaultSamplingProbability(), 0.0001);
assertEquals(0.001666, actual.getDefaultLowerBoundTracesPerSecond(), 0.0001);
List<PerOperationSamplingParameters> actualPerOperationStrategies = actual.getPerOperationStrategies();
assertEquals(2, actualPerOperationStrategies.size());
assertEquals(new PerOperationSamplingParameters("GET:/search", new ProbabilisticSamplingStrategy(1.0)), actualPerOperationStrategies.get(0));
assertEquals(new PerOperationSamplingParameters("PUT:/pacifique", new ProbabilisticSamplingStrategy(0.8258308134813166)), actualPerOperationStrategies.get(1));
}
use of io.jaegertracing.internal.samplers.http.SamplingStrategyResponse in project jaeger-client-java by jaegertracing.
the class HttpSamplingManagerTest method testGetSamplingStrategy.
@Test
public void testGetSamplingStrategy() throws Exception {
URI uri = target().getUri();
undertest = new HttpSamplingManager(uri.getHost() + ":" + uri.getPort());
SamplingStrategyResponse response = undertest.getSamplingStrategy("clairvoyant");
assertNotNull(response.getProbabilisticSampling());
}
use of io.jaegertracing.internal.samplers.http.SamplingStrategyResponse in project jaeger-client-java by jaegertracing.
the class HttpSamplingManagerTest method testParseProbabilisticSampling.
@Test
public void testParseProbabilisticSampling() throws Exception {
SamplingStrategyResponse response = undertest.parseJson(readFixture("probabilistic_sampling.json"));
assertEquals(new ProbabilisticSamplingStrategy(0.01), response.getProbabilisticSampling());
assertNull(response.getRateLimitingSampling());
}
use of io.jaegertracing.internal.samplers.http.SamplingStrategyResponse in project jaeger-client-java by jaegertracing.
the class RemoteControlledSamplerTest method testUpdateToProbabilisticSampler.
@Test
public void testUpdateToProbabilisticSampler() throws Exception {
final double samplingRate = 0.55;
SamplingStrategyResponse probabilisticResponse = new SamplingStrategyResponse(new ProbabilisticSamplingStrategy(samplingRate), null, null);
when(samplingManager.getSamplingStrategy(SERVICE_NAME)).thenReturn(probabilisticResponse);
undertest.updateSampler();
assertEquals(new ProbabilisticSampler(samplingRate), undertest.getSampler());
}
use of io.jaegertracing.internal.samplers.http.SamplingStrategyResponse in project jaeger-client-java by jaegertracing.
the class RemoteControlledSamplerTest method testUpdateToRateLimitingSampler.
@Test
public void testUpdateToRateLimitingSampler() throws Exception {
final int tracesPerSecond = 22;
SamplingStrategyResponse rateLimitingResponse = new SamplingStrategyResponse(null, new RateLimitingSamplingStrategy(tracesPerSecond), null);
when(samplingManager.getSamplingStrategy(SERVICE_NAME)).thenReturn(rateLimitingResponse);
undertest.updateSampler();
assertEquals(new RateLimitingSampler(tracesPerSecond), undertest.getSampler());
}
Aggregations