Search in sources :

Example 1 with InMemoryReporter

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

the class JaegerRequestAndResponseInterceptorIntegrationTest method setUp.

@Before
public void setUp() {
    mockServerClient.when(HttpRequest.request().withMethod("GET").withPath("/testing")).respond(HttpResponse.response().withStatusCode(200));
    reporter = new InMemoryReporter();
    Sampler sampler = new ConstSampler(true);
    tracer = new Tracer.Builder("test_service", reporter, sampler).build();
    parentSpan = (Span) tracer.buildSpan("parent_operation").startManual();
    parentSpan.setBaggageItem(BAGGAGE_KEY, BAGGAGE_VALUE);
    parentSpan.finish();
    // Set up a parent span context
    tracer.scopeManager().activate(parentSpan, false);
}
Also used : InMemoryReporter(com.uber.jaeger.reporters.InMemoryReporter) Sampler(com.uber.jaeger.samplers.Sampler) ConstSampler(com.uber.jaeger.samplers.ConstSampler) HttpAsyncClientBuilder(org.apache.http.impl.nio.client.HttpAsyncClientBuilder) HttpClientBuilder(org.apache.http.impl.client.HttpClientBuilder) ConstSampler(com.uber.jaeger.samplers.ConstSampler) Before(org.junit.Before)

Example 2 with InMemoryReporter

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

the class ServerFilterTest method setUp.

@Before
public void setUp() {
    reporter = new InMemoryReporter();
    tracer = new com.uber.jaeger.Tracer.Builder("Angry Machine", reporter, new ConstSampler(true)).build();
    // Using deprecated constructor for test coverage
    undertest = new ServerFilter(tracer, null);
}
Also used : InMemoryReporter(com.uber.jaeger.reporters.InMemoryReporter) ConstSampler(com.uber.jaeger.samplers.ConstSampler) Before(org.junit.Before)

Example 3 with InMemoryReporter

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

the class ZipkinSenderTest method setUp.

@Before
public void setUp() throws Exception {
    reporter = new InMemoryReporter();
    tracer = new Tracer.Builder("test-sender", reporter, new ConstSampler(true)).withStatsReporter(new InMemoryStatsReporter()).build();
    sender = newSender(messageMaxBytes);
    converter = new ThriftSpanConverter();
}
Also used : InMemoryReporter(com.uber.jaeger.reporters.InMemoryReporter) InMemoryStatsReporter(com.uber.jaeger.metrics.InMemoryStatsReporter) Tracer(com.uber.jaeger.Tracer) ConstSampler(com.uber.jaeger.samplers.ConstSampler) Before(org.junit.Before)

Example 4 with InMemoryReporter

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

the class TracerTagsTest method testDeclaredHostTags.

@Test
public void testDeclaredHostTags() throws Exception {
    InMemoryReporter spanReporter = new InMemoryReporter();
    String hostname = "myhost";
    String ip = "1.1.1.1";
    Tracer tracer = new Tracer.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(com.uber.jaeger.reporters.InMemoryReporter) Test(org.junit.Test)

Example 5 with InMemoryReporter

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

the class TracerTagsTest method testTracerTags.

@Test
public void testTracerTags() throws Exception {
    InMemoryReporter spanReporter = new InMemoryReporter();
    Tracer tracer = new Tracer.Builder("x", spanReporter, new ConstSampler(true)).withZipkinSharedRpcSpan().withTag("tracer.tag.str", "y").build();
    Span span = (Span) tracer.buildSpan("root").startManual();
    // span should only contain sampler tags and no tracer tags
    assertEquals(2, span.getTags().size());
    assertEquals(true, span.getTags().containsKey("sampler.type"));
    assertEquals(true, span.getTags().containsKey("sampler.param"));
    assertEquals(false, span.getTags().containsKey("tracer.tag.str"));
}
Also used : InMemoryReporter(com.uber.jaeger.reporters.InMemoryReporter) ConstSampler(com.uber.jaeger.samplers.ConstSampler) 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