Search in sources :

Example 1 with SamplingManager

use of io.jaegertracing.spi.SamplingManager in project jaeger-client-java by jaegertracing.

the class RemoteControlledSamplerTest method testUpdateFailureKeepsTimerRunning.

@Test
public void testUpdateFailureKeepsTimerRunning() throws InterruptedException {
    undertest.close();
    CountDownLatch latch = new CountDownLatch(3);
    SamplingManager failingManager = serviceName -> {
        latch.countDown();
        throw new RuntimeException("test update failure");
    };
    undertest = new RemoteControlledSampler.Builder(SERVICE_NAME).withSamplingManager(failingManager).withInitialSampler(initialSampler).withMetrics(metrics).withPollingInterval(1).build();
    assertTrue(latch.await(1, TimeUnit.SECONDS));
}
Also used : SamplingStrategyErrorException(io.jaegertracing.internal.exceptions.SamplingStrategyErrorException) Metrics(io.jaegertracing.internal.metrics.Metrics) Mock(org.mockito.Mock) OperationSamplingParameters(io.jaegertracing.internal.samplers.http.OperationSamplingParameters) RunWith(org.junit.runner.RunWith) RateLimitingSamplingStrategy(io.jaegertracing.internal.samplers.http.RateLimitingSamplingStrategy) ArrayList(java.util.ArrayList) InMemoryMetricsFactory(io.jaegertracing.internal.metrics.InMemoryMetricsFactory) After(org.junit.After) Sampler(io.jaegertracing.spi.Sampler) PerOperationSamplingParameters(io.jaegertracing.internal.samplers.http.PerOperationSamplingParameters) Before(org.junit.Before) Assert.assertTrue(org.junit.Assert.assertTrue) Mockito.times(org.mockito.Mockito.times) Test(org.junit.Test) Mockito.when(org.mockito.Mockito.when) SamplingManager(io.jaegertracing.spi.SamplingManager) Assert.assertNotEquals(org.junit.Assert.assertNotEquals) SamplingStrategyResponse(io.jaegertracing.internal.samplers.http.SamplingStrategyResponse) Mockito.verify(org.mockito.Mockito.verify) TimeUnit(java.util.concurrent.TimeUnit) CountDownLatch(java.util.concurrent.CountDownLatch) List(java.util.List) ProbabilisticSamplingStrategy(io.jaegertracing.internal.samplers.http.ProbabilisticSamplingStrategy) MockitoJUnitRunner(org.mockito.junit.MockitoJUnitRunner) Assert.assertEquals(org.junit.Assert.assertEquals) Mockito.mock(org.mockito.Mockito.mock) SamplingManager(io.jaegertracing.spi.SamplingManager) CountDownLatch(java.util.concurrent.CountDownLatch) Test(org.junit.Test)

Aggregations

SamplingStrategyErrorException (io.jaegertracing.internal.exceptions.SamplingStrategyErrorException)1 InMemoryMetricsFactory (io.jaegertracing.internal.metrics.InMemoryMetricsFactory)1 Metrics (io.jaegertracing.internal.metrics.Metrics)1 OperationSamplingParameters (io.jaegertracing.internal.samplers.http.OperationSamplingParameters)1 PerOperationSamplingParameters (io.jaegertracing.internal.samplers.http.PerOperationSamplingParameters)1 ProbabilisticSamplingStrategy (io.jaegertracing.internal.samplers.http.ProbabilisticSamplingStrategy)1 RateLimitingSamplingStrategy (io.jaegertracing.internal.samplers.http.RateLimitingSamplingStrategy)1 SamplingStrategyResponse (io.jaegertracing.internal.samplers.http.SamplingStrategyResponse)1 Sampler (io.jaegertracing.spi.Sampler)1 SamplingManager (io.jaegertracing.spi.SamplingManager)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 TimeUnit (java.util.concurrent.TimeUnit)1 After (org.junit.After)1 Assert.assertEquals (org.junit.Assert.assertEquals)1 Assert.assertNotEquals (org.junit.Assert.assertNotEquals)1 Assert.assertTrue (org.junit.Assert.assertTrue)1 Before (org.junit.Before)1 Test (org.junit.Test)1