use of brave.sampler.Sampler in project brave by openzipkin.
the class HttpClientHandlerTest method handleSend_traceIdSamplerSpecialCased.
@Test
public void handleSend_traceIdSamplerSpecialCased() {
Sampler sampler = mock(Sampler.class);
init(httpTracingBuilder(tracingBuilder().sampler(sampler)).clientSampler(SamplerFunctions.deferDecision()));
assertThat(handler.handleSend(request).isNoop()).isTrue();
verify(sampler).isSampled(anyLong());
}
use of brave.sampler.Sampler in project brave by openzipkin.
the class TracerTest method sampler.
@Test
public void sampler() {
Sampler sampler = new Sampler() {
@Override
public boolean isSampled(long traceId) {
return false;
}
};
tracer = Tracing.newBuilder().sampler(sampler).build().tracer();
assertThat(tracer.sampler).isSameAs(sampler);
}
use of brave.sampler.Sampler in project brave by openzipkin.
the class TracerTest method withSampler.
@Test
public void withSampler() {
Sampler sampler = new Sampler() {
@Override
public boolean isSampled(long traceId) {
return false;
}
};
tracer = tracer.withSampler(sampler);
assertThat(tracer.sampler).isSameAs(sampler);
}
use of brave.sampler.Sampler in project brave by openzipkin.
the class AspectJSamplerTest method clear.
@Before
public void clear() {
tracing.set(Tracing.newBuilder().currentTraceContext(currentTraceContext).addSpanHandler(spans).sampler(new Sampler() {
@Override
public boolean isSampled(long traceId) {
// in this case, we aren't expecting a fallback
throw new AssertionError();
}
}).build());
spans.clear();
}
use of brave.sampler.Sampler in project brave by openzipkin.
the class RpcServerHandlerTest 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