Search in sources :

Example 1 with ConstSampler

use of io.jaegertracing.internal.samplers.ConstSampler in project jaeger-client-java by jaegertracing.

the class RemovedFrom032Test method setUp.

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

Example 2 with ConstSampler

use of io.jaegertracing.internal.samplers.ConstSampler in project jaeger-client-java by jaegertracing.

the class MicrometerTest method validateMetricCounts.

@Test
public void validateMetricCounts() throws InterruptedException {
    Sampler constantSampler = new ConstSampler(true);
    Configuration configuration = new Configuration("validateMetricCounts");
    JaegerTracer tracer = configuration.getTracerBuilder().withSampler(constantSampler).withMetrics(metrics).build();
    createSomeSpans(tracer);
    tracer.close();
    double finishedSpans = registry.get("jaeger_tracer_finished_spans").counter().count();
    double startedSpans = registry.get("jaeger_tracer_started_spans").tag("sampled", "y").counter().count();
    double traces = registry.get("jaeger_tracer_traces").tag("sampled", "y").tag("state", "started").counter().count();
    assertEquals("Wrong number of finishedSpans", 4.0, finishedSpans, assertDelta);
    assertEquals("Wrong number of startedSpans", 10.0, startedSpans, assertDelta);
    assertEquals("Wrong number of traces", 10.0, traces, assertDelta);
}
Also used : Configuration(io.jaegertracing.Configuration) Sampler(io.jaegertracing.spi.Sampler) ConstSampler(io.jaegertracing.internal.samplers.ConstSampler) ConstSampler(io.jaegertracing.internal.samplers.ConstSampler) JaegerTracer(io.jaegertracing.internal.JaegerTracer) Test(org.junit.Test)

Example 3 with ConstSampler

use of io.jaegertracing.internal.samplers.ConstSampler in project jaeger-client-java by jaegertracing.

the class RemoteReporterTest method testFlushIsCalledOnSender.

@Test
public void testFlushIsCalledOnSender() throws InterruptedException {
    CountDownLatch latch = new CountDownLatch(1);
    InMemorySender sender = new InMemorySender() {

        @Override
        public int flush() throws SenderException {
            latch.countDown();
            return super.flush();
        }
    };
    RemoteReporter remoteReporter = new Builder().withSender(sender).withFlushInterval(flushInterval).withMaxQueueSize(maxQueueSize).withMetrics(metrics).build();
    tracer = new JaegerTracer.Builder("test-remote-reporter").withReporter(remoteReporter).withSampler(new ConstSampler(true)).withMetrics(metrics).build();
    tracer.buildSpan("mySpan").start().finish();
    remoteReporter.flush();
    latch.await();
    assertEquals("Should have called the custom sender flush", 0, latch.getCount());
    assertEquals("mySpan", (sender.getReceived().get(0)).getOperationName());
}
Also used : Builder(io.jaegertracing.internal.reporters.RemoteReporter.Builder) InMemorySender(io.jaegertracing.internal.senders.InMemorySender) ConstSampler(io.jaegertracing.internal.samplers.ConstSampler) CountDownLatch(java.util.concurrent.CountDownLatch) JaegerTracer(io.jaegertracing.internal.JaegerTracer) Test(org.junit.Test)

Example 4 with ConstSampler

use of io.jaegertracing.internal.samplers.ConstSampler in project jaeger-client-java by jaegertracing.

the class ActiveSpanTest method setUp.

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

Example 5 with ConstSampler

use of io.jaegertracing.internal.samplers.ConstSampler in project jaeger-client-java by jaegertracing.

the class JaegerSpanTest method setUp.

@Before
public void setUp() {
    metricsFactory = new InMemoryMetricsFactory();
    reporter = new InMemoryReporter();
    clock = mock(Clock.class);
    metrics = new Metrics(metricsFactory);
    final JaegerTracer.Builder tracerBuilder = new JaegerTracer.Builder("SamplerTest").withReporter(reporter).withSampler(new ConstSampler(true)).withMetrics(metrics).withClock(clock).withBaggageRestrictionManager(new DefaultBaggageRestrictionManager()).withExpandExceptionLogs();
    tracer = tracerBuilder.build();
    tracer128 = tracerBuilder.withTraceId128Bit().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) Clock(io.jaegertracing.internal.clock.Clock) DefaultBaggageRestrictionManager(io.jaegertracing.internal.baggage.DefaultBaggageRestrictionManager) Before(org.junit.Before)

Aggregations

ConstSampler (io.jaegertracing.internal.samplers.ConstSampler)33 InMemoryReporter (io.jaegertracing.internal.reporters.InMemoryReporter)22 JaegerTracer (io.jaegertracing.internal.JaegerTracer)21 Test (org.junit.Test)19 Before (org.junit.Before)13 InMemoryMetricsFactory (io.jaegertracing.internal.metrics.InMemoryMetricsFactory)9 Metrics (io.jaegertracing.internal.metrics.Metrics)7 JaegerSpan (io.jaegertracing.internal.JaegerSpan)6 Builder (io.jaegertracing.internal.reporters.RemoteReporter.Builder)5 InMemorySender (io.jaegertracing.internal.senders.InMemorySender)4 Builder (io.jaegertracing.internal.JaegerTracer.Builder)3 TextMap (io.opentracing.propagation.TextMap)3 HashMap (java.util.HashMap)3 UseDataProvider (com.tngtech.java.junit.dataprovider.UseDataProvider)2 DefaultBaggageRestrictionManager (io.jaegertracing.internal.baggage.DefaultBaggageRestrictionManager)2 SenderException (io.jaegertracing.internal.exceptions.SenderException)2 Sampler (io.jaegertracing.spi.Sampler)2 Map (java.util.Map)2 TreeMap (java.util.TreeMap)2 CountDownLatch (java.util.concurrent.CountDownLatch)2