Search in sources :

Example 11 with InMemoryReporter

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

the class JaegerThriftSpanConverterTest method setUp.

@Before
public void setUp() {
    final JaegerTracer.Builder tracerBuilder = new JaegerTracer.Builder("test-service-name").withReporter(new InMemoryReporter()).withSampler(new ConstSampler(true));
    tracer = tracerBuilder.build();
    tracer128 = tracerBuilder.withTraceId128Bit().build();
}
Also used : InMemoryReporter(io.jaegertracing.internal.reporters.InMemoryReporter) ConstSampler(io.jaegertracing.internal.samplers.ConstSampler) JaegerTracer(io.jaegertracing.internal.JaegerTracer) Before(org.junit.Before)

Example 12 with InMemoryReporter

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

the class EndToEndBehaviorResourceTest method setUp.

@Before
public void setUp() throws Exception {
    reporter = new InMemoryReporter();
    Tracer tracer = new JaegerTracer.Builder("crossdock-java").withReporter(reporter).withSampler(new ConstSampler(true)).build();
    Map<String, Tracer> tracers = new HashMap<>();
    tracers.put("const", tracer);
    resource = new EndToEndBehaviorResource(new EndToEndBehavior(tracers));
}
Also used : InMemoryReporter(io.jaegertracing.internal.reporters.InMemoryReporter) EndToEndBehavior(io.jaegertracing.crossdock.resources.behavior.EndToEndBehavior) HashMap(java.util.HashMap) Tracer(io.opentracing.Tracer) JaegerTracer(io.jaegertracing.internal.JaegerTracer) ConstSampler(io.jaegertracing.internal.samplers.ConstSampler) JaegerTracer(io.jaegertracing.internal.JaegerTracer) Before(org.junit.Before)

Example 13 with InMemoryReporter

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

the class JaegerTracerTagsTest method testTracerTags.

@Test
public void testTracerTags() {
    InMemoryReporter spanReporter = new InMemoryReporter();
    JaegerTracer tracer = new JaegerTracer.Builder("x").withReporter(spanReporter).withSampler(new ConstSampler(true)).withZipkinSharedRpcSpan().withTag("tracer.tag.str", "y").build();
    JaegerSpan jaegerSpan = tracer.buildSpan("root").start();
    // span should only contain sampler tags and no tracer tags
    assertEquals(2, jaegerSpan.getTags().size());
    assertEquals(true, jaegerSpan.getTags().containsKey("sampler.type"));
    assertEquals(true, jaegerSpan.getTags().containsKey("sampler.param"));
    assertEquals(false, jaegerSpan.getTags().containsKey("tracer.tag.str"));
}
Also used : InMemoryReporter(io.jaegertracing.internal.reporters.InMemoryReporter) JaegerSpan(io.jaegertracing.internal.JaegerSpan) ConstSampler(io.jaegertracing.internal.samplers.ConstSampler) JaegerTracer(io.jaegertracing.internal.JaegerTracer) Test(org.junit.Test)

Example 14 with InMemoryReporter

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

the class JaegerTracerTagsTest method testEmptyDeclaredIpTag.

@Test
public void testEmptyDeclaredIpTag() {
    InMemoryReporter spanReporter = new InMemoryReporter();
    String ip = "";
    JaegerTracer tracer = new JaegerTracer.Builder("x").withReporter(spanReporter).withTag(Constants.TRACER_IP_TAG_KEY, ip).build();
    assertEquals(0, tracer.getIpv4());
}
Also used : InMemoryReporter(io.jaegertracing.internal.reporters.InMemoryReporter) JaegerTracer(io.jaegertracing.internal.JaegerTracer) Test(org.junit.Test)

Example 15 with InMemoryReporter

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

the class JaegerTracerTagsTest method testDeclaredHostTags.

@Test
public void testDeclaredHostTags() {
    InMemoryReporter spanReporter = new InMemoryReporter();
    String hostname = "myhost";
    String ip = "1.1.1.1";
    JaegerTracer tracer = new JaegerTracer.Builder("x").withReporter(spanReporter).withTag(Constants.TRACER_HOSTNAME_TAG_KEY, hostname).withTag(Constants.TRACER_IP_TAG_KEY, ip).build();
    assertEquals(hostname, tracer.tags().get(Constants.TRACER_HOSTNAME_TAG_KEY));
    assertEquals(ip, tracer.tags().get(Constants.TRACER_IP_TAG_KEY));
    assertEquals(Utils.ipToInt(ip), tracer.getIpv4());
}
Also used : InMemoryReporter(io.jaegertracing.internal.reporters.InMemoryReporter) JaegerTracer(io.jaegertracing.internal.JaegerTracer) Test(org.junit.Test)

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