DataDog / dd-trace-java

Datadog APM client for Java
https://docs.datadoghq.com/tracing/languages/java
Apache License 2.0
583 stars 289 forks source link

Vertex integration throw NullPointerException due to null span #5185

Open miladjafary opened 1 year ago

miladjafary commented 1 year ago

Hi I have used the dd-trace-java agent to trace my service which is develop on top of Quarkus framework. However when DataDog agent wants to trace a vertx request generate the following error which say the span is null.

Could you help me out how could I resolve it? I use the latest version of trace which I download it from https://dtdg.co/latest-java-tracer

java.lang.NullPointerException: Cannot invoke "datadog.trace.bootstrap.instrumentation.api.AgentSpan.setTag(String, java.lang.CharSequence)" because "span" is null
        at datadog.trace.bootstrap.instrumentation.decorator.http.HttpResourceDecorator.withRoute(HttpResourceDecorator.java:45)
        at datadog.trace.instrumentation.vertx_4_0.server.EndHandlerWrapper.handle(EndHandlerWrapper.java:33)
        at datadog.trace.instrumentation.vertx_4_0.server.EndHandlerWrapper.handle(EndHandlerWrapper.java:13)
        at io.quarkus.vertx.http.runtime.filters.QuarkusRequestWrapper$ResponseWrapper$3.handle(QuarkusRequestWrapper.java:145)
        at io.quarkus.vertx.http.runtime.filters.QuarkusRequestWrapper$ResponseWrapper$3.handle(QuarkusRequestWrapper.java:140)
        at io.vertx.core.http.impl.Http1xServerResponse.end(Http1xServerResponse.java:441)
        at io.vertx.core.http.impl.Http1xServerResponse.end(Http1xServerResponse.java:409)
        at io.quarkus.vertx.http.runtime.filters.AbstractResponseWrapper.end(AbstractResponseWrapper.java:233)
        at io.quarkus.micrometer.runtime.export.handlers.PrometheusHandler.doHandle(PrometheusHandler.java:63)
        at io.quarkus.micrometer.runtime.export.handlers.PrometheusHandler.handle(PrometheusHandler.java:43)
        at io.quarkus.micrometer.runtime.export.handlers.PrometheusHandler.handle(PrometheusHandler.java:18)
        at io.vertx.ext.web.impl.BlockingHandlerDecorator.lambda$handle$0(BlockingHandlerDecorator.java:48)
        at io.vertx.core.impl.ContextBase.lambda$null$0(ContextBase.java:137)
        at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:264)
        at io.vertx.core.impl.ContextBase.lambda$executeBlocking$1(ContextBase.java:135)
        at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
        at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
        at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:833)
glauberduarte commented 1 year ago

Hi @smola is there any workaround to solve this problem?

bm1549 commented 1 year ago

Can you confirm if the fix in #5203 resolves your issue?

It was released as part of v1.15.0, but ideally you should use the latest release of v.1.21.0

miladjafary commented 11 months ago

@bm1549 I've used the version 1.24.2 and I confirmed it has been fixed