use of com.uber.jaeger.samplers.ConstSampler 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));
}
use of com.uber.jaeger.samplers.ConstSampler in project jaeger-client-java by jaegertracing.
the class SpanTest method setUp.
@Before
public void setUp() {
metricsFactory = new InMemoryMetricsFactory();
reporter = new InMemoryReporter();
clock = mock(Clock.class);
metrics = new Metrics(metricsFactory);
tracer = new Tracer.Builder("SamplerTest", reporter, new ConstSampler(true)).withMetrics(metrics).withClock(clock).withBaggageRestrictionManager(new DefaultBaggageRestrictionManager()).withExpandExceptionLogs().build();
span = (Span) tracer.buildSpan("some-operation").start();
}
use of com.uber.jaeger.samplers.ConstSampler in project jaeger-client-java by jaegertracing.
the class TracerTest method testAsChildOfAcceptNull.
@Test
public void testAsChildOfAcceptNull() {
tracer = new Tracer.Builder("foo", new InMemoryReporter(), new ConstSampler(true)).build();
Span span = (Span) tracer.buildSpan("foo").asChildOf((Span) null).start();
span.finish();
assertTrue(span.getReferences().isEmpty());
span = (Span) tracer.buildSpan("foo").asChildOf((io.opentracing.SpanContext) null).start();
span.finish();
assertTrue(span.getReferences().isEmpty());
}
use of com.uber.jaeger.samplers.ConstSampler in project jaeger-client-java by jaegertracing.
the class BaggageSetterTest method setUp.
@Before
public void setUp() throws Exception {
metricsFactory = new InMemoryMetricsFactory();
reporter = new InMemoryReporter();
metrics = new Metrics(metricsFactory);
mgr = mock(DefaultBaggageRestrictionManager.class);
setter = new BaggageSetter(mgr, metrics);
tracer = new Tracer.Builder(SERVICE, reporter, new ConstSampler(true)).withMetrics(metrics).build();
span = (Span) tracer.buildSpan("some-operation").startManual();
}
use of com.uber.jaeger.samplers.ConstSampler in project jaeger-client-java by jaegertracing.
the class InMemoryMetricsFactoryTest method emptyValueForTag.
@Test
public void emptyValueForTag() {
InMemoryMetricsFactory metricsFactory = new InMemoryMetricsFactory();
Tracer tracer = new Tracer.Builder("metricsFactoryTest", new InMemoryReporter(), new ConstSampler(true)).withMetrics(new Metrics(metricsFactory)).build();
tracer.buildSpan("theoperation").start();
assertEquals(-1, metricsFactory.getCounter("jaeger:started_spans", "sampled"));
assertEquals(-1, metricsFactory.getCounter("jaeger:started_spans", ""));
}
Aggregations