【问题标题】:Error while tracing Java Application with Jaeger使用 Jaeger 跟踪 Java 应用程序时出错
【发布时间】:2019-10-16 05:36:38
【问题描述】:

我有一个简单的 Java 应用程序,我想用 Jaeger 测试跟踪但遇到错误。

maven 依赖 -

        <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>

杰格一体机-

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

这里是代码-

    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();

    }

我遇到了错误 -

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)

感谢任何帮助!

【问题讨论】:

    标签: opentracing jaeger


    【解决方案1】:

    这是由于 helidon 依赖。

    https://helidon.io/docs/latest/#/guides/03_quickstart-mp

    我还必须将opentracing-api 版本升级到0.33.0

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多