Search in sources :

Example 6 with InMemoryReporter

use of com.uber.jaeger.reporters.InMemoryReporter in project jaeger-client-java by jaegertracing.

the class TracerTagsTest method testEmptyDeclaredIpTag.

@Test
public void testEmptyDeclaredIpTag() throws Exception {
    InMemoryReporter spanReporter = new InMemoryReporter();
    String ip = "";
    Tracer tracer = new Tracer.Builder("x").withReporter(spanReporter).withTag(Constants.TRACER_IP_TAG_KEY, ip).build();
    assertEquals(0, tracer.getIpv4());
}
Also used : InMemoryReporter(com.uber.jaeger.reporters.InMemoryReporter) Test(org.junit.Test)

Example 7 with InMemoryReporter

use of com.uber.jaeger.reporters.InMemoryReporter in project jaeger-client-java by jaegertracing.

the class TracerTagsTest method testShortDeclaredIpTag.

@Test
public void testShortDeclaredIpTag() throws Exception {
    InMemoryReporter spanReporter = new InMemoryReporter();
    String ip = ":19";
    Tracer tracer = new Tracer.Builder("x").withReporter(spanReporter).withTag(Constants.TRACER_IP_TAG_KEY, ip).build();
    assertEquals(0, tracer.getIpv4());
}
Also used : InMemoryReporter(com.uber.jaeger.reporters.InMemoryReporter) Test(org.junit.Test)

Example 8 with InMemoryReporter

use of com.uber.jaeger.reporters.InMemoryReporter in project jaeger-client-java by jaegertracing.

the class TracerTest method testRegisterInjector.

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

Example 9 with InMemoryReporter

use of com.uber.jaeger.reporters.InMemoryReporter in project jaeger-client-java by jaegertracing.

the class TracerTest method setUp.

@Before
public void setUp() throws Exception {
    metricsFactory = new InMemoryMetricsFactory();
    tracer = new Tracer.Builder("TracerTestService").withReporter(new InMemoryReporter()).withSampler(new ConstSampler(true)).withMetrics(new Metrics(metricsFactory)).build();
}
Also used : InMemoryReporter(com.uber.jaeger.reporters.InMemoryReporter) InMemoryMetricsFactory(com.uber.jaeger.metrics.InMemoryMetricsFactory) Metrics(com.uber.jaeger.metrics.Metrics) ConstSampler(com.uber.jaeger.samplers.ConstSampler) Builder(com.uber.jaeger.Tracer.Builder) Before(org.junit.Before)

Example 10 with InMemoryReporter

use of com.uber.jaeger.reporters.InMemoryReporter in project jaeger-client-java by jaegertracing.

the class TracerTest method testWithBaggageRestrictionManager.

@Test
public void testWithBaggageRestrictionManager() {
    tracer = new Tracer.Builder("TracerTestService", new InMemoryReporter(), new ConstSampler(true)).withMetrics(new Metrics(metricsFactory)).build();
    Span span = (Span) tracer.buildSpan("some-operation").start();
    final String key = "key";
    tracer.setBaggage(span, key, "value");
    assertEquals(1, metricsFactory.getCounter("jaeger:baggage_updates", "result=ok"));
}
Also used : InMemoryReporter(com.uber.jaeger.reporters.InMemoryReporter) Metrics(com.uber.jaeger.metrics.Metrics) ConstSampler(com.uber.jaeger.samplers.ConstSampler) Builder(com.uber.jaeger.Tracer.Builder) Test(org.junit.Test)

Aggregations

InMemoryReporter (com.uber.jaeger.reporters.InMemoryReporter)30 ConstSampler (com.uber.jaeger.samplers.ConstSampler)26 Test (org.junit.Test)19 Before (org.junit.Before)10 Tracer (com.uber.jaeger.Tracer)7 Metrics (com.uber.jaeger.metrics.Metrics)5 Scope (io.opentracing.Scope)5 Builder (com.uber.jaeger.Tracer.Builder)4 InMemoryMetricsFactory (com.uber.jaeger.metrics.InMemoryMetricsFactory)4 InMemoryStatsReporter (com.uber.jaeger.metrics.InMemoryStatsReporter)3 TextMap (io.opentracing.propagation.TextMap)3 HashMap (java.util.HashMap)3 Tracer (io.opentracing.Tracer)2 UseDataProvider (com.tngtech.java.junit.dataprovider.UseDataProvider)1 BinaryAnnotation (com.twitter.zipkin.thriftjava.BinaryAnnotation)1 Span (com.uber.jaeger.Span)1 DefaultBaggageRestrictionManager (com.uber.jaeger.baggage.DefaultBaggageRestrictionManager)1 EndToEndBehavior (com.uber.jaeger.crossdock.resources.behavior.EndToEndBehavior)1 ClientFilter (com.uber.jaeger.filters.jaxrs2.ClientFilter)1 Sampler (com.uber.jaeger.samplers.Sampler)1