Search in sources :

Example 26 with InMemoryReporter

use of io.jaegertracing.internal.reporters.InMemoryReporter in project jaeger-client-java by jaegertracing.

the class JaegerTracerTest method setUp.

@Before
public void setUp() {
    metricsFactory = new InMemoryMetricsFactory();
    tracer = new JaegerTracer.Builder("TracerTestService").withReporter(new InMemoryReporter()).withSampler(new ConstSampler(true)).withMetrics(new Metrics(metricsFactory)).build();
}
Also used : InMemoryReporter(io.jaegertracing.internal.reporters.InMemoryReporter) InMemoryMetricsFactory(io.jaegertracing.internal.metrics.InMemoryMetricsFactory) Metrics(io.jaegertracing.internal.metrics.Metrics) Builder(io.jaegertracing.internal.JaegerTracer.Builder) ConstSampler(io.jaegertracing.internal.samplers.ConstSampler) Before(org.junit.Before)

Example 27 with InMemoryReporter

use of io.jaegertracing.internal.reporters.InMemoryReporter in project jaeger-client-java by jaegertracing.

the class JaegerTracerTest method testWithBaggageRestrictionManager.

@Test
public void testWithBaggageRestrictionManager() {
    tracer = new JaegerTracer.Builder("TracerTestService").withReporter(new InMemoryReporter()).withSampler(new ConstSampler(true)).withMetrics(new Metrics(metricsFactory)).build();
    JaegerSpan span = tracer.buildSpan("some-operation").start();
    final String key = "key";
    tracer.setBaggage(span, key, "value");
    assertEquals(1, metricsFactory.getCounter("jaeger_tracer_baggage_updates", "result=ok"));
}
Also used : InMemoryReporter(io.jaegertracing.internal.reporters.InMemoryReporter) Metrics(io.jaegertracing.internal.metrics.Metrics) Builder(io.jaegertracing.internal.JaegerTracer.Builder) ConstSampler(io.jaegertracing.internal.samplers.ConstSampler) Test(org.junit.Test)

Example 28 with InMemoryReporter

use of io.jaegertracing.internal.reporters.InMemoryReporter in project jaeger-client-java by jaegertracing.

the class JaegerTracerTest method testRegisterInjector.

@Test
public void testRegisterInjector() {
    @SuppressWarnings("unchecked") Injector<TextMap> injector = mock(Injector.class);
    JaegerTracer tracer = new JaegerTracer.Builder("TracerTestService").withReporter(new InMemoryReporter()).withSampler(new ConstSampler(true)).withMetrics(new Metrics(new InMemoryMetricsFactory())).registerInjector(Format.Builtin.TEXT_MAP, injector).build();
    JaegerSpan span = tracer.buildSpan("leela").start();
    TextMap carrier = mock(TextMap.class);
    tracer.inject(span.context(), Format.Builtin.TEXT_MAP, carrier);
    verify(injector).inject(any(JaegerSpanContext.class), any(TextMap.class));
}
Also used : InMemoryReporter(io.jaegertracing.internal.reporters.InMemoryReporter) Metrics(io.jaegertracing.internal.metrics.Metrics) InMemoryMetricsFactory(io.jaegertracing.internal.metrics.InMemoryMetricsFactory) Builder(io.jaegertracing.internal.JaegerTracer.Builder) ConstSampler(io.jaegertracing.internal.samplers.ConstSampler) TextMap(io.opentracing.propagation.TextMap) Test(org.junit.Test)

Example 29 with InMemoryReporter

use of io.jaegertracing.internal.reporters.InMemoryReporter in project jaeger-client-java by jaegertracing.

the class BaggageSetterTest method setUp.

@Before
public void setUp() {
    metricsFactory = new InMemoryMetricsFactory();
    reporter = new InMemoryReporter();
    metrics = new Metrics(metricsFactory);
    mgr = mock(DefaultBaggageRestrictionManager.class);
    setter = new BaggageSetter(mgr, metrics);
    tracer = new JaegerTracer.Builder(SERVICE).withReporter(reporter).withSampler(new ConstSampler(true)).withMetrics(metrics).build();
    jaegerSpan = tracer.buildSpan("some-operation").start();
}
Also used : InMemoryReporter(io.jaegertracing.internal.reporters.InMemoryReporter) InMemoryMetricsFactory(io.jaegertracing.internal.metrics.InMemoryMetricsFactory) Metrics(io.jaegertracing.internal.metrics.Metrics) ConstSampler(io.jaegertracing.internal.samplers.ConstSampler) JaegerTracer(io.jaegertracing.internal.JaegerTracer) Before(org.junit.Before)

Aggregations

InMemoryReporter (io.jaegertracing.internal.reporters.InMemoryReporter)29 ConstSampler (io.jaegertracing.internal.samplers.ConstSampler)22 JaegerTracer (io.jaegertracing.internal.JaegerTracer)19 Test (org.junit.Test)17 Before (org.junit.Before)12 JaegerSpan (io.jaegertracing.internal.JaegerSpan)7 InMemoryMetricsFactory (io.jaegertracing.internal.metrics.InMemoryMetricsFactory)6 Metrics (io.jaegertracing.internal.metrics.Metrics)5 HashMap (java.util.HashMap)5 Builder (io.jaegertracing.internal.JaegerTracer.Builder)3 TextMap (io.opentracing.propagation.TextMap)3 UseDataProvider (com.tngtech.java.junit.dataprovider.UseDataProvider)2 JaegerSpanContext (io.jaegertracing.internal.JaegerSpanContext)2 TextMapAdapter (io.opentracing.propagation.TextMapAdapter)2 Map (java.util.Map)2 TreeMap (java.util.TreeMap)2 BinaryAnnotation (com.twitter.zipkin.thriftjava.BinaryAnnotation)1 EndToEndBehavior (io.jaegertracing.crossdock.resources.behavior.EndToEndBehavior)1 DefaultBaggageRestrictionManager (io.jaegertracing.internal.baggage.DefaultBaggageRestrictionManager)1 Clock (io.jaegertracing.internal.clock.Clock)1