I've a simple Java application that I wanted to test tracing with Jaeger but encountered error.
maven dependency -
<dependency>
<groupId>io.opentracing</groupId>
<artifactId>opentracing-api</artifactId>
<version>0.32.0</version>
</dependency>
<dependency>
<groupId>io.jaegertracing</groupId>
<artifactId>jaeger-client</artifactId>
<version>1.0.0</version>
</dependency>
jaeger all-in-one -
docker run -d --name jaeger \
-e COLLECTOR_ZIPKIN_HTTP_PORT=9411 \
-p 5775:5775/udp \
-p 6831:6831/udp \
-p 5778:5778 \
-p 16686:16686 \
-p 14268:14268 \
-p 9411:9411 \
jaegertracing/all-in-one:1.6
Here is the code -
public static void main(final String[] args) {
System.setProperty(Configuration.JAEGER_SAMPLER_TYPE, ConstSampler.TYPE);
System.setProperty(Configuration.JAEGER_SAMPLER_PARAM, "1");
System.setProperty(Configuration.JAEGER_SERVICE_NAME, "test-1");
Span span = Configuration.fromEnv().getTracer().buildSpan("test-hello").start();
span.setTag("test-Tag", "test-value");
span.log("test log");
span.finish();
}
and I'm getting error -
INFO: Initialized tracer=JaegerTracer(version=Java-1.0.0, serviceName=test-1, reporter=RemoteReporter(sender=UdpSender(), closeEnqueueTimeout=1000), sampler=ConstSampler(decision=true, tags={sampler.type=const, sampler.param=true}), tags={hostname=ADURAI-mac, jaeger.version=Java-1.0.0, ip=192.168.1.3}, zipkinSharedRpcSpan=false, expandExceptionLogs=false, useTraceId128Bit=false)
Exception in thread "main" java.lang.AbstractMethodError: io.opentracing.util.ThreadLocalScopeManager.activeSpan()Lio/opentracing/Span;
at io.jaegertracing.internal.JaegerTracer$SpanBuilder.start(JaegerTracer.java:440)
at io.adurai.kafka.producer.Main.main(Main.java:44)
Appreciate any help !
This was due to the helidon dependency.
https://helidon.io/docs/latest/#/guides/03_quickstart-mp
Also I had to upgrade opentracing-api
version to 0.33.0