Search in sources :

Example 11 with Sampler

use of brave.sampler.Sampler in project brave by openzipkin.

the class RpcClientHandlerTest 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());
}
Also used : Sampler(brave.sampler.Sampler) Test(org.junit.Test)

Example 12 with Sampler

use of brave.sampler.Sampler in project brave by openzipkin.

the class RpcServerHandlerTest 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);
}
Also used : Sampler(brave.sampler.Sampler) Test(org.junit.Test)

Aggregations

Sampler (brave.sampler.Sampler)12 Test (org.junit.Test)10 DeclarativeSampler (brave.sampler.DeclarativeSampler)1 Before (org.junit.Before)1