Search in sources :

Example 11 with InMemoryReporter

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

the class InMemoryMetricsFactoryTest method canBeUsedWithMetrics.

@Test
public void canBeUsedWithMetrics() {
    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=y"));
    assertEquals(0, metricsFactory.getCounter("jaeger:started_spans", "sampled=n"));
    assertEquals(1, metricsFactory.getCounter("jaeger:traces", "sampled=y,state=started"));
    assertEquals(0, metricsFactory.getCounter("jaeger:traces", "sampled=n,state=started"));
}
Also used : InMemoryReporter(com.uber.jaeger.reporters.InMemoryReporter) Tracer(com.uber.jaeger.Tracer) ConstSampler(com.uber.jaeger.samplers.ConstSampler) Test(org.junit.Test)

Example 12 with InMemoryReporter

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

the class NoopMetricsFactoryTest method canBeUsedWithMetrics.

@Test
public void canBeUsedWithMetrics() {
    NoopMetricsFactory metricsFactory = new NoopMetricsFactory();
    Tracer tracer = new Tracer.Builder("metricsFactoryTest", new InMemoryReporter(), new ConstSampler(true)).withMetrics(new Metrics(metricsFactory)).build();
    tracer.buildSpan("theoperation").start();
}
Also used : InMemoryReporter(com.uber.jaeger.reporters.InMemoryReporter) Tracer(com.uber.jaeger.Tracer) ConstSampler(com.uber.jaeger.samplers.ConstSampler) Test(org.junit.Test)

Example 13 with InMemoryReporter

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

the class UdpSenderTest method setUp.

@Before
public void setUp() throws Exception {
    server = startServer();
    reporter = new InMemoryReporter();
    tracer = new Tracer.Builder(SERVICE_NAME, reporter, new ConstSampler(true)).withStatsReporter(new InMemoryStatsReporter()).withTag("foo", "bar").build();
    sender = new UdpSender(destHost, destPort, maxPacketSize);
}
Also used : InMemoryReporter(com.uber.jaeger.reporters.InMemoryReporter) InMemoryStatsReporter(com.uber.jaeger.metrics.InMemoryStatsReporter) ConstSampler(com.uber.jaeger.samplers.ConstSampler) Before(org.junit.Before)

Example 14 with InMemoryReporter

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

the class ClientFilterTest method setUp.

@Before
public void setUp() throws Exception {
    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 ClientFilter(tracer, null);
}
Also used : InMemoryReporter(com.uber.jaeger.reporters.InMemoryReporter) ConstSampler(com.uber.jaeger.samplers.ConstSampler) Before(org.junit.Before)

Example 15 with InMemoryReporter

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

the class FilterIntegrationTest method setUp.

@Before
public void setUp() throws Exception {
    metricsReporter = new InMemoryStatsReporter();
    reporter = new InMemoryReporter();
    tracer = new com.uber.jaeger.Tracer.Builder("some-op-name", reporter, new ConstSampler(true)).withStatsReporter(metricsReporter).build();
    // start the server
    server = new JerseyServer(tracer);
    server.start();
    // create the client
    client = ClientBuilder.newClient().register(new ClientFilter(tracer)).register(JacksonFeature.class);
}
Also used : InMemoryReporter(com.uber.jaeger.reporters.InMemoryReporter) JacksonFeature(org.glassfish.jersey.jackson.JacksonFeature) InMemoryStatsReporter(com.uber.jaeger.metrics.InMemoryStatsReporter) Tracer(io.opentracing.Tracer) ConstSampler(com.uber.jaeger.samplers.ConstSampler) ClientFilter(com.uber.jaeger.filters.jaxrs2.ClientFilter) Before(org.junit.Before)

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