Order rules alphabetically and ensure matches.
MODIFY
dd-java-agent-ittests/src/test/resources/logback.xml
dd-java-agent-ittests/src/test/resources/logback.xml
</layout>
</appender>
- <root level="INFO">
+ <root level="DEBUG">
<appender-ref ref="console"/>
</root>

MODIFY
dd-java-agent/src/main/java/com/datadoghq/trace/agent/TraceAnnotationsManager.java
dd-java-agent/src/main/java/com/datadoghq/trace/agent/TraceAnnotationsManager.java
@@ -123,6 +123,8 @@ public class TraceAnnotationsManager {
return scripts;
}
+ log.debug("Loading rules with classloader {}", classLoader == null ? "bootstrap" : classLoader);
+
final List<String> scriptNames = new ArrayList<>();
// Load default and custom rules
@@ -140,7 +142,7 @@ public class TraceAnnotationsManager {
log.warn("Failed to install scripts", e);
}
}
- log.trace(sw.toString());
+ log.debug(sw.toString());
} catch (IOException | URISyntaxException e) {
log.warn("Failed to load OpenTracing agent rules", e);
}

MODIFY
dd-java-agent/src/main/resources/dd-trace-supported-framework.yaml
dd-java-agent/src/main/resources/dd-trace-supported-framework.yaml
@@ -34,35 +34,14 @@ opentracing-cassandra-driver:
- com.datastax.driver.core.RemoteEndpointAwareNettySSLOptions
- com.datastax.driver.core.GuavaCompatibility
-opentracing-web-servlet-filter:
- - artifact: jetty-server
- supported_version: (8\.|9\.).*
-# identifying_present_classes:
-
- - artifact: tomcat_catalina
- supported_version: (8\.|9\.).*
- identifying_present_classes:
- - org.apache.catalina.WebResource
- - org.apache.catalina.webresources.TrackedInputStream
- - org.apache.catalina.webresources.AbstractArchiveResource
-
- - artifact: tomcat-embed-core
- supported_version: (8\.|9\.).*
- identifying_present_classes:
- - org.apache.catalina.WebResource
- - org.apache.catalina.webresources.TrackedInputStream
- - org.apache.catalina.webresources.AbstractArchiveResource
-
-opentracing-okhttp3:
- - artifact: okhttp
- supported_version: 3\..*
+opentracing-jms-2_producer:
+ - artifact: javax.jms-api
+ supported_version: 2\..*
identifying_present_classes:
- - okhttp3.Cookie
- - okhttp3.ConnectionPool
- - okhttp3.Headers
+ - javax.jms.JMSContext
+ - javax.jms.CompletionListener
-# For rules opentracing-jms-2_{consumer,producer}
-opentracing-jms-2:
+opentracing-jms-2_consumer:
- artifact: javax.jms-api
supported_version: 2\..*
identifying_present_classes:
@@ -82,3 +61,45 @@ opentracing-mongo-driver:
identifying_present_classes:
- com.mongodb.operation.AsyncReadOperation
- com.mongodb.client.model.MapReduceAction
+
+opentracing-mongo-driver-helper:
+ - artifact: mongo-java-driver
+ supported_version: 3\..*
+ identifying_present_classes:
+ - com.mongodb.operation.AsyncReadOperation
+ - com.mongodb.client.model.MapReduceAction
+
+ - check:
+ artifact: mongodb-driver-async
+ supported_version: 3\..*
+ identifying_present_classes:
+ - com.mongodb.operation.AsyncReadOperation
+ - com.mongodb.client.model.MapReduceAction
+
+opentracing-okhttp3:
+ - artifact: okhttp
+ supported_version: 3\..*
+ identifying_present_classes:
+ - okhttp3.Cookie
+ - okhttp3.ConnectionPool
+ - okhttp3.Headers
+
+opentracing-web-servlet-filter_jetty:
+ - artifact: jetty-server
+ supported_version: (8\.|9\.).*
+# identifying_present_classes:
+
+opentracing-web-servlet-filter_tomcat:
+ - artifact: opentracing-web-servlet-filter_tomcat
+ supported_version: (8\.|9\.).*
+ identifying_present_classes:
+ - org.apache.catalina.WebResource
+ - org.apache.catalina.webresources.TrackedInputStream
+ - org.apache.catalina.webresources.AbstractArchiveResource
+
+ - artifact: opentracing-web-servlet-filter_tomcat
+ supported_version: (8\.|9\.).*
+ identifying_present_classes:
+ - org.apache.catalina.WebResource
+ - org.apache.catalina.webresources.TrackedInputStream
+ - org.apache.catalina.webresources.AbstractArchiveResource

MODIFY
dd-java-agent/src/main/resources/otarules.btm
dd-java-agent/src/main/resources/otarules.btm
###
-# Instrument Mongo client
-# ========================
-RULE opentracing-mongo-driver
-CLASS com.mongodb.MongoClientOptions$Builder
-METHOD build
-HELPER com.datadoghq.trace.agent.integration.MongoHelper
-AT ENTRY
-IF getState($0) == 0
-DO
- patch($this);
-ENDRULE
-
-RULE mongo-decorator
-CLASS io.opentracing.contrib.mongo.TracingCommandListener
-METHOD decorate
-HELPER com.datadoghq.trace.agent.integration.MongoHelper
+# Instrument Apache HTTP Client
+# =============================
+RULE opentracing-apache-httpclient
+CLASS org.apache.http.impl.client.HttpClientBuilder
+METHOD create()
+HELPER com.datadoghq.trace.agent.integration.ApacheHTTPClientHelper
AT EXIT
IF TRUE
DO
- decorate($1, $2);
+ $! = patch($!);
ENDRULE
@@ -45,12 +35,12 @@ DO
ENDRULE
-# Instrument Apache HTTP Client
-# =============================
-RULE opentracing-apache-httpclient
-CLASS org.apache.http.impl.client.HttpClientBuilder
-METHOD create()
-HELPER com.datadoghq.trace.agent.integration.ApacheHTTPClientHelper
+# Instrument Cassandra client
+# ===========================
+RULE opentracing-cassandra-driver
+CLASS com.datastax.driver.core.Cluster$Manager
+METHOD newSession()
+HELPER com.datadoghq.trace.agent.integration.CassandraHelper
AT EXIT
IF TRUE
DO
@@ -58,12 +48,12 @@ DO
ENDRULE
-# Instrument Cassandra client
+# Instrument JMS
# ===========================
-RULE opentracing-cassandra-driver
-CLASS com.datastax.driver.core.Cluster$Manager
-METHOD newSession()
-HELPER com.datadoghq.trace.agent.integration.CassandraHelper
+RULE opentracing-jms-2_producer
+INTERFACE javax.jms.Session
+METHOD createProducer
+HELPER com.datadoghq.trace.agent.integration.JMSMessageProducerHelper
AT EXIT
IF TRUE
DO
@@ -71,32 +61,37 @@ DO
ENDRULE
-# Instrument Jetty
-# ===========================
-# State 0 - no filter installed
-# State 1 - filter installed
-RULE opentracing-web-servlet-filter_jetty
-CLASS org.eclipse.jetty.servlet.ServletContextHandler
-METHOD <init>
-HELPER com.datadoghq.trace.agent.integration.JettyServletHelper
+RULE opentracing-jms-2_consumer
+INTERFACE javax.jms.Session
+METHOD createConsumer
+HELPER com.datadoghq.trace.agent.integration.JMSMessageConsumerHelper
AT EXIT
-IF getState($0.getServletContext()) == 0
+IF TRUE
DO
- patch($this)
+ $! = patch($!);
ENDRULE
-# Instrument Tomcat
-# ===========================
-RULE opentracing-web-servlet-filter_tomcat
-CLASS org.apache.catalina.core.ApplicationContext
-METHOD <init>
-IMPORT javax.servlet.Filter
-HELPER com.datadoghq.trace.agent.integration.TomcatServletHelper
+# Instrument Mongo client
+# ========================
+RULE opentracing-mongo-driver
+CLASS com.mongodb.MongoClientOptions$Builder
+METHOD build
+HELPER com.datadoghq.trace.agent.integration.MongoHelper
+AT ENTRY
+IF getState($0) == 0
+DO
+ patch($this);
+ENDRULE
+
+RULE opentracing-mongo-driver-helper
+CLASS io.opentracing.contrib.mongo.TracingCommandListener
+METHOD decorate
+HELPER com.datadoghq.trace.agent.integration.MongoHelper
AT EXIT
IF TRUE
DO
- patch($this)
+ decorate($1, $2);
ENDRULE
@@ -113,26 +108,30 @@ DO
ENDRULE
-# Instrument JMS
+# Instrument Servlet - Jetty
# ===========================
-RULE opentracing-jms-2_producer
-INTERFACE javax.jms.Session
-METHOD createProducer
-HELPER com.datadoghq.trace.agent.integration.JMSMessageProducerHelper
+# State 0 - no filter installed
+# State 1 - filter installed
+RULE opentracing-web-servlet-filter_jetty
+CLASS org.eclipse.jetty.servlet.ServletContextHandler
+METHOD <init>
+HELPER com.datadoghq.trace.agent.integration.JettyServletHelper
AT EXIT
-IF TRUE
+IF getState($0.getServletContext()) == 0
DO
- $! = patch($!);
+ patch($this)
ENDRULE
-RULE opentracing-jms-2_consumer
-INTERFACE javax.jms.Session
-METHOD createConsumer
-HELPER com.datadoghq.trace.agent.integration.JMSMessageConsumerHelper
+# Instrument Servlet - Tomcat
+# ===========================
+RULE opentracing-web-servlet-filter_tomcat
+CLASS org.apache.catalina.core.ApplicationContext
+METHOD <init>
+HELPER com.datadoghq.trace.agent.integration.TomcatServletHelper
AT EXIT
IF TRUE
DO
- $! = patch($!);
+ patch($this)
ENDRULE

Order rules alphabetically and ensure matches.