@Test public void testNullResponse() throws Exception { when(samplingManager.getSamplingStrategy(SERVICE_NAME)).thenReturn(new SamplingStrategyResponse(null, null, null)); undertest.updateSampler(); assertEquals(initialSampler, undertest.getSampler()); }
void updateSampler() { 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); } }
RemoteControlledSampler implements Sampler { void updateSampler() { 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); } } }
RemoteControlledSampler implements Sampler { void updateSampler() { 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); } } private  RemoteControlledSampler(Builder builder); }
RemoteControlledSampler implements Sampler { void updateSampler() { 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); } } private  RemoteControlledSampler(Builder builder); @Override SamplingStatus sample(String operation, long id); @Override boolean equals(Object sampler); @Override void close(); }
RemoteControlledSampler implements Sampler { void updateSampler() { 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); } } private  RemoteControlledSampler(Builder builder); @Override SamplingStatus sample(String operation, long id); @Override boolean equals(Object sampler); @Override void close(); static final String TYPE; }