Search in sources :

Example 1 with BaggageRestrictionManager

use of io.jaegertracing.spi.BaggageRestrictionManager in project jaeger-client-java by jaegertracing.

the class JaegerSpanTest method testSetAndGetBaggageItem.

@Test
public void testSetAndGetBaggageItem() {
    final String service = "SamplerTest";
    final BaggageRestrictionManager mgr = Mockito.mock(DefaultBaggageRestrictionManager.class);
    tracer = new JaegerTracer.Builder(service).withReporter(reporter).withSampler(new ConstSampler(true)).withClock(clock).withBaggageRestrictionManager(mgr).build();
    jaegerSpan = tracer.buildSpan("some-operation").start();
    final String key = "key";
    final String value = "value";
    when(mgr.getRestriction(service, key)).thenReturn(Restriction.of(true, 10));
    jaegerSpan.setBaggageItem(key, "value");
    verify(mgr).getRestriction(service, key);
    assertEquals(value, jaegerSpan.getBaggageItem(key));
}
Also used : ConstSampler(io.jaegertracing.internal.samplers.ConstSampler) DefaultBaggageRestrictionManager(io.jaegertracing.internal.baggage.DefaultBaggageRestrictionManager) BaggageRestrictionManager(io.jaegertracing.spi.BaggageRestrictionManager) Test(org.junit.Test)

Aggregations

DefaultBaggageRestrictionManager (io.jaegertracing.internal.baggage.DefaultBaggageRestrictionManager)1 ConstSampler (io.jaegertracing.internal.samplers.ConstSampler)1 BaggageRestrictionManager (io.jaegertracing.spi.BaggageRestrictionManager)1 Test (org.junit.Test)1