Search in sources :

Example 1 with BaggageRestrictionManager

use of com.uber.jaeger.baggage.BaggageRestrictionManager in project jaeger-client-java by jaegertracing.

the class SpanTest method testSetAndGetBaggageItem.

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

Aggregations

BaggageRestrictionManager (com.uber.jaeger.baggage.BaggageRestrictionManager)1 DefaultBaggageRestrictionManager (com.uber.jaeger.baggage.DefaultBaggageRestrictionManager)1 ConstSampler (com.uber.jaeger.samplers.ConstSampler)1 Test (org.junit.Test)1