diff --git a/dd-java-agent/instrumentation/java-concurrent/src/main/java/datadog/trace/instrumentation/java/concurrent/AbstractExecutorInstrumentation.java b/dd-java-agent/instrumentation/java-concurrent/src/main/java/datadog/trace/instrumentation/java/concurrent/AbstractExecutorInstrumentation.java index fe605c66b44..78ec84d493e 100644 --- a/dd-java-agent/instrumentation/java-concurrent/src/main/java/datadog/trace/instrumentation/java/concurrent/AbstractExecutorInstrumentation.java +++ b/dd-java-agent/instrumentation/java-concurrent/src/main/java/datadog/trace/instrumentation/java/concurrent/AbstractExecutorInstrumentation.java @@ -1,21 +1,20 @@ package datadog.trace.instrumentation.java.concurrent; +import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.implementsInterface; +import static net.bytebuddy.matcher.ElementMatchers.any; +import static net.bytebuddy.matcher.ElementMatchers.named; + import datadog.trace.agent.tooling.Instrumenter; import datadog.trace.api.Config; -import lombok.extern.slf4j.Slf4j; -import net.bytebuddy.description.type.TypeDescription; -import net.bytebuddy.matcher.ElementMatcher; - import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.Set; import java.util.concurrent.Executor; - -import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.implementsInterface; -import static net.bytebuddy.matcher.ElementMatchers.any; -import static net.bytebuddy.matcher.ElementMatchers.named; +import lombok.extern.slf4j.Slf4j; +import net.bytebuddy.description.type.TypeDescription; +import net.bytebuddy.matcher.ElementMatcher; @Slf4j public abstract class AbstractExecutorInstrumentation extends Instrumenter.Default { diff --git a/dd-java-agent/instrumentation/mule-http-connector-1.0/src/main/java/datadog/trace/instrumentation/mulehttpconnector/server/ServerDecorator.java b/dd-java-agent/instrumentation/mule-http-connector-1.0/src/main/java/datadog/trace/instrumentation/mulehttpconnector/server/ServerDecorator.java index 675725d742b..2d6e2ed2035 100644 --- a/dd-java-agent/instrumentation/mule-http-connector-1.0/src/main/java/datadog/trace/instrumentation/mulehttpconnector/server/ServerDecorator.java +++ b/dd-java-agent/instrumentation/mule-http-connector-1.0/src/main/java/datadog/trace/instrumentation/mulehttpconnector/server/ServerDecorator.java @@ -73,7 +73,8 @@ public static void onHttpCodecFilterExit(FilterChainContext ctx, HttpHeader http HttpRequestPacket httpRequest = (HttpRequestPacket) httpHeader; HttpResponsePacket httpResponse = httpRequest.getResponse(); AgentSpan span = startSpan("http.request", propagate().extract(httpHeader, GETTER)); - AgentScope scope = activateSpan(span).setAsyncPropagation(true); + AgentScope scope = activateSpan(span); + scope.setAsyncPropagation(true); DECORATE.afterStart(span); ctx.getAttributes().setAttribute(SPAN, span); ctx.getAttributes().setAttribute(RESPONSE, httpResponse); diff --git a/dd-java-agent/instrumentation/mule-http-connector-1.0/src/test/groovy/GrizzlyAsyncHttpClientTest.groovy b/dd-java-agent/instrumentation/mule-http-connector-1.0/src/test/groovy/GrizzlyAsyncHttpClientTest.groovy index 8d81a24e140..d09e14d3d22 100644 --- a/dd-java-agent/instrumentation/mule-http-connector-1.0/src/test/groovy/GrizzlyAsyncHttpClientTest.groovy +++ b/dd-java-agent/instrumentation/mule-http-connector-1.0/src/test/groovy/GrizzlyAsyncHttpClientTest.groovy @@ -1,4 +1,8 @@ -import com.ning.http.client.* +import com.ning.http.client.AsyncCompletionHandler +import com.ning.http.client.AsyncHttpClient +import com.ning.http.client.Request +import com.ning.http.client.RequestBuilder +import com.ning.http.client.Response import com.ning.http.client.uri.Uri import datadog.trace.agent.test.base.HttpClientTest import datadog.trace.instrumentation.mulehttpconnector.client.ClientDecorator diff --git a/dd-java-agent/instrumentation/mule-http-connector-1.0/src/test/groovy/GrizzlyFilterchainServerTest.groovy b/dd-java-agent/instrumentation/mule-http-connector-1.0/src/test/groovy/GrizzlyFilterchainServerTest.groovy index b625a20b90d..54e7a5cebd6 100644 --- a/dd-java-agent/instrumentation/mule-http-connector-1.0/src/test/groovy/GrizzlyFilterchainServerTest.groovy +++ b/dd-java-agent/instrumentation/mule-http-connector-1.0/src/test/groovy/GrizzlyFilterchainServerTest.groovy @@ -1,7 +1,15 @@ import datadog.trace.agent.test.base.HttpServerTest import datadog.trace.instrumentation.mulehttpconnector.server.ServerDecorator -import org.glassfish.grizzly.filterchain.* -import org.glassfish.grizzly.http.* +import org.glassfish.grizzly.filterchain.BaseFilter +import org.glassfish.grizzly.filterchain.FilterChain +import org.glassfish.grizzly.filterchain.FilterChainContext +import org.glassfish.grizzly.filterchain.NextAction +import org.glassfish.grizzly.filterchain.TransportFilter +import org.glassfish.grizzly.http.HttpContent +import org.glassfish.grizzly.http.HttpHeader +import org.glassfish.grizzly.http.HttpRequestPacket +import org.glassfish.grizzly.http.HttpResponsePacket +import org.glassfish.grizzly.http.HttpServerFilter import org.glassfish.grizzly.http.server.HttpServer import org.glassfish.grizzly.nio.transport.TCPNIOServerConnection import org.glassfish.grizzly.nio.transport.TCPNIOTransport @@ -11,7 +19,14 @@ import org.glassfish.grizzly.utils.IdleTimeoutFilter import java.util.concurrent.Executors -import static datadog.trace.agent.test.base.HttpServerTest.ServerEndpoint.* +import static datadog.trace.agent.test.base.HttpServerTest.ServerEndpoint.AUTH_REQUIRED +import static datadog.trace.agent.test.base.HttpServerTest.ServerEndpoint.ERROR +import static datadog.trace.agent.test.base.HttpServerTest.ServerEndpoint.EXCEPTION +import static datadog.trace.agent.test.base.HttpServerTest.ServerEndpoint.NOT_FOUND +import static datadog.trace.agent.test.base.HttpServerTest.ServerEndpoint.PATH_PARAM +import static datadog.trace.agent.test.base.HttpServerTest.ServerEndpoint.QUERY_PARAM +import static datadog.trace.agent.test.base.HttpServerTest.ServerEndpoint.REDIRECT +import static datadog.trace.agent.test.base.HttpServerTest.ServerEndpoint.SUCCESS import static java.lang.String.valueOf import static java.nio.charset.Charset.defaultCharset import static java.util.concurrent.TimeUnit.MILLISECONDS @@ -173,7 +188,7 @@ class GrizzlyFilterchainServerTest extends HttpServerTest { byte[] responseBody ResponseParameters(HttpServerTest.ServerEndpoint endpoint, - status, + int status, byte[] responseBody, Map headers) { this.endpoint = endpoint diff --git a/internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api/AgentTracer.java b/internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api/AgentTracer.java index b1bbbf40082..19ab2f7aa14 100644 --- a/internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api/AgentTracer.java +++ b/internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api/AgentTracer.java @@ -30,6 +30,7 @@ public static AgentSpan startSpan( /** * Activates the span without finishing on closing the active scope + * * @param span the span to activate * @return a newly activated scope */