Search in sources :

Example 1 with SamplingStrategyErrorException

use of io.jaegertracing.internal.exceptions.SamplingStrategyErrorException in project jaeger-client-java by jaegertracing.

the class RemoteControlledSampler method updateSampler.

/**
 * Updates {@link #sampler} to a new sampler when it is different.
 */
void updateSampler() {
    // visible for testing
    SamplingStrategyResponse response;
    try {
        response = manager.getSamplingStrategy(serviceName);
        metrics.samplerRetrieved.inc(1);
    } catch (SamplingStrategyErrorException e) {
        metrics.samplerQueryFailure.inc(1);
        return;
    }
    if (response.getOperationSampling() != null) {
        updatePerOperationSampler(response.getOperationSampling());
    } else {
        updateRateLimitingOrProbabilisticSampler(response);
    }
}
Also used : SamplingStrategyResponse(io.jaegertracing.internal.samplers.http.SamplingStrategyResponse) SamplingStrategyErrorException(io.jaegertracing.internal.exceptions.SamplingStrategyErrorException)

Example 2 with SamplingStrategyErrorException

use of io.jaegertracing.internal.exceptions.SamplingStrategyErrorException in project jaeger-client-java by jaegertracing.

the class RemoteControlledSamplerTest method testUnparseableResponse.

@Test
public void testUnparseableResponse() throws Exception {
    when(samplingManager.getSamplingStrategy(SERVICE_NAME)).thenThrow(new SamplingStrategyErrorException("test"));
    undertest.updateSampler();
    assertEquals(initialSampler, undertest.getSampler());
}
Also used : SamplingStrategyErrorException(io.jaegertracing.internal.exceptions.SamplingStrategyErrorException) Test(org.junit.Test)

Aggregations

SamplingStrategyErrorException (io.jaegertracing.internal.exceptions.SamplingStrategyErrorException)2 SamplingStrategyResponse (io.jaegertracing.internal.samplers.http.SamplingStrategyResponse)1 Test (org.junit.Test)1