use of brave.sampler.Sampler in project brave by openzipkin.
the class RpcClientHandlerTest method handleSend_neverSamplerSpecialCased.
@Test
public void handleSend_neverSamplerSpecialCased() {
Sampler sampler = mock(Sampler.class);
init(httpTracingBuilder(tracingBuilder().sampler(sampler)).clientSampler(SamplerFunctions.neverSample()));
assertThat(handler.handleSend(request).isNoop()).isTrue();
verifyNoMoreInteractions(sampler);
}
use of brave.sampler.Sampler in project spring-cloud-sleuth by spring-cloud.
the class ProbabilityBasedSamplerTests method countNumberOfSampledElements.
private int countNumberOfSampledElements(int numberOfIterations) {
Sampler sampler = new ProbabilityBasedSampler(this.samplerConfiguration);
int passedCounter = 0;
for (int i = 0; i < numberOfIterations; i++) {
boolean passed = sampler.isSampled(RANDOM.nextLong());
passedCounter = passedCounter + (passed ? 1 : 0);
}
return passedCounter;
}
use of brave.sampler.Sampler in project brave by openzipkin.
the class HttpClientHandlerTest method handleSend_neverSamplerSpecialCased.
@Test
public void handleSend_neverSamplerSpecialCased() {
Sampler sampler = mock(Sampler.class);
init(httpTracingBuilder(tracingBuilder().sampler(sampler)).clientSampler(SamplerFunctions.neverSample()));
assertThat(handler.handleSend(request).isNoop()).isTrue();
verifyNoMoreInteractions(sampler);
}
use of brave.sampler.Sampler in project brave by openzipkin.
the class HttpServerHandlerTest method handleReceive_neverSamplerSpecialCased.
@Test
public void handleReceive_neverSamplerSpecialCased() {
Sampler sampler = mock(Sampler.class);
init(httpTracingBuilder(tracingBuilder().sampler(sampler)).serverSampler(SamplerFunctions.neverSample()));
assertThat(handler.handleReceive(request).isNoop()).isTrue();
verifyNoMoreInteractions(sampler);
}
use of brave.sampler.Sampler in project brave by openzipkin.
the class HttpServerHandlerTest method handleReceive_traceIdSamplerSpecialCased.
@Test
public void handleReceive_traceIdSamplerSpecialCased() {
Sampler sampler = mock(Sampler.class);
init(httpTracingBuilder(tracingBuilder().sampler(sampler)).serverSampler(SamplerFunctions.deferDecision()));
assertThat(handler.handleReceive(request).isNoop()).isTrue();
verify(sampler).isSampled(anyLong());
}
Aggregations