use of io.jaegertracing.internal.JaegerTracer in project jaeger-client-java by jaegertracing.
the class ThriftSenderTest method appendFail.
@Test(expected = SenderException.class)
public void appendFail() throws Exception {
int size = 0;
ThriftSender sender = new ThriftSender(ProtocolType.Compact, 0) {
@Override
public void send(Process process, List<Span> spans) throws SenderException {
throw new SenderException("", null, spans.size());
}
};
JaegerTracer tracer = new JaegerTracer.Builder("failure").build();
sender.append(tracer.buildSpan("flush-fail").start());
sender.flush();
}
use of io.jaegertracing.internal.JaegerTracer in project jaeger-client-java by jaegertracing.
the class ThriftSenderTest method flushFail.
@Test(expected = SenderException.class)
public void flushFail() throws Exception {
ThriftSender sender = new ThriftSender(ProtocolType.Compact, 0) {
@Override
public void send(Process process, List<Span> spans) throws SenderException {
throw new SenderException("", null, spans.size());
}
};
JaegerTracer tracer = new JaegerTracer.Builder("failure").build();
sender.append(tracer.buildSpan("flush-fail").start());
sender.flush();
}
use of io.jaegertracing.internal.JaegerTracer in project jaeger-client-java by jaegertracing.
the class JaegerTracerResolverTest method canFindTracerResolver.
@Test
public void canFindTracerResolver() {
System.setProperty(Configuration.JAEGER_SERVICE_NAME, "canFindTracerResolver");
TracerResolver tracerResolver = ServiceLoader.load(TracerResolver.class).iterator().next();
assertNotNull(tracerResolver);
assertTrue(tracerResolver instanceof JaegerTracerResolver);
JaegerTracer tracer = ((JaegerTracerResolver) tracerResolver).resolve();
assertNotNull(tracer);
}
use of io.jaegertracing.internal.JaegerTracer 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"));
}
use of io.jaegertracing.internal.JaegerTracer in project jaeger-client-java by jaegertracing.
the class JaegerTracerTagsTest method testEmptyDeclaredIpTag.
@Test
public void testEmptyDeclaredIpTag() {
InMemoryReporter spanReporter = new InMemoryReporter();
String ip = "";
JaegerTracer tracer = new JaegerTracer.Builder("x").withReporter(spanReporter).withTag(Constants.TRACER_IP_TAG_KEY, ip).build();
assertEquals(0, tracer.getIpv4());
}
Aggregations