Search in sources :

Example 16 with ConstSampler

use of io.jaegertracing.internal.samplers.ConstSampler 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 17 with ConstSampler

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

the class ActiveSpanTest method testCustomScopeManager.

@Test
public void testCustomScopeManager() {
    Span span = mock(Span.class);
    Scope scope = mock(Scope.class);
    JaegerTracer tracer = new JaegerTracer.Builder("test").withReporter(new InMemoryReporter()).withSampler(new ConstSampler(true)).withScopeManager(new ScopeManager() {

        @Override
        public Scope activate(Span span) {
            return scope;
        }

        @Override
        public Span activeSpan() {
            return span;
        }
    }).build();
    assertEquals(span, tracer.scopeManager().activeSpan());
    assertEquals(scope, tracer.scopeManager().activate(span));
}
Also used : InMemoryReporter(io.jaegertracing.internal.reporters.InMemoryReporter) ScopeManager(io.opentracing.ScopeManager) Scope(io.opentracing.Scope) ConstSampler(io.jaegertracing.internal.samplers.ConstSampler) Span(io.opentracing.Span) Test(org.junit.Test)

Example 18 with ConstSampler

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

the class UdpSenderTest method setUp.

@Before
public void setUp() throws Exception {
    server = startServer();
    reporter = new InMemoryReporter();
    final JaegerTracer.Builder tracerBuilder = new JaegerTracer.Builder(SERVICE_NAME).withReporter(reporter).withSampler(new ConstSampler(true)).withMetricsFactory(new InMemoryMetricsFactory()).withTag("foo", "bar");
    tracer = tracerBuilder.build();
    tracer128 = tracerBuilder.withTraceId128Bit().build();
    sender = new UdpSender(destHost, destPort, maxPacketSize);
}
Also used : InMemoryReporter(io.jaegertracing.internal.reporters.InMemoryReporter) InMemoryMetricsFactory(io.jaegertracing.internal.metrics.InMemoryMetricsFactory) ConstSampler(io.jaegertracing.internal.samplers.ConstSampler) JaegerTracer(io.jaegertracing.internal.JaegerTracer) Before(org.junit.Before)

Example 19 with ConstSampler

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

the class ZipkinSenderTest method setUp.

@Before
public void setUp() {
    reporter = new InMemoryReporter();
    final JaegerTracer.Builder tracerBuilder = new JaegerTracer.Builder("test-sender").withReporter(reporter).withSampler(new ConstSampler(true)).withMetricsFactory(new InMemoryMetricsFactory());
    tracer = tracerBuilder.build();
    tracer128 = tracerBuilder.withTraceId128Bit().build();
    sender = newSender(messageMaxBytes);
    converter = new ThriftSpanConverter();
}
Also used : InMemoryReporter(io.jaegertracing.internal.reporters.InMemoryReporter) InMemoryMetricsFactory(io.jaegertracing.internal.metrics.InMemoryMetricsFactory) ConstSampler(io.jaegertracing.internal.samplers.ConstSampler) ThriftSpanConverter(io.jaegertracing.zipkin.internal.ThriftSpanConverter) JaegerTracer(io.jaegertracing.internal.JaegerTracer) Before(org.junit.Before)

Example 20 with ConstSampler

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

the class V2SpanConverterTest method setUp.

@Before
public void setUp() {
    final JaegerTracer.Builder tracerBuilder = new JaegerTracer.Builder("test-service-name").withReporter(new InMemoryReporter()).withSampler(new ConstSampler(true)).withZipkinSharedRpcSpan();
    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)

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