Enable the following instrumentation by default: grizzly, jetty, spark-java
MODIFY
README.md
README.md
@@ -20,7 +20,7 @@ to capture telemetry from a number of popular libraries and frameworks.
| [Finatra](https://github.com/twitter/finatra) | 2.9+ |
| [Geode Client](https://geode.apache.org/) | 1.4+ |
| [Google HTTP Client](https://github.com/googleapis/google-http-java-client) | 1.19+ |
-| [Grizzly](https://javaee.github.io/grizzly/httpserverframework.html) | 2.0+ |
+| [Grizzly](https://javaee.github.io/grizzly/httpserverframework.html) | 2.0+ (disabled by default, see below) |
| [gRPC](https://github.com/grpc/grpc-java) | 1.5+ |
| [Hibernate](https://github.com/hibernate/hibernate-orm) | 3.3+ |
| [HttpURLConnection](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/HttpURLConnection.html) | Java 7+ |
@@ -128,6 +128,24 @@ These parameter names are very likely to change over time, so please check back
Please report any bugs or unexpected behavior you may find.
+## Disabled instrumentations
+Some instrumentations can produce too many spans and make traces very noisy.
+For this reason the following instrumentations are disabled by default:
+- `jdbc-datasource` which creates spans whenever `java.sql.DataSource#getConnection` method is called.
+- `servlet-filter` which creates spans around Servlet Filter methods.
+- `servlet-service` which creates spans around Servlet methods.
+
+To enable them, add `ota.integration.<name>.enabled` system property:
+`-Dota.integration.jdbc-datasource.enabled=true`
+
+### Grizzly instrumentation
+Whenever you use [Grizzly](https://javaee.github.io/grizzly/httpserverframework.html)
+for Servlet-based applications, you get better experience from Servlet-specific support.
+As these two instrumentations conflict with each other, more generic instrumentation for Grizzly
+http server is disabled by default.
+If needed, you can enable it by add the following system property:
+`-Dota.integration.grizzly.enabled=true`
+
## Troubleshooting
To turn on the agent's internal debug logging:

MODIFY
instrumentation/grizzly-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/GrizzlyHttpHandlerInstrumentation.java
instrumentation/grizzly-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/GrizzlyHttpHandlerInstrumentation.java
@@ -47,7 +47,7 @@ public class GrizzlyHttpHandlerInstrumentation extends Instrumenter.Default {
}
@Override
- public boolean defaultEnabled() {
+ protected boolean defaultEnabled() {
return false;
}

MODIFY
instrumentation/jetty-8.0/src/main/java/io/opentelemetry/auto/instrumentation/jetty/JettyHandlerInstrumentation.java
instrumentation/jetty-8.0/src/main/java/io/opentelemetry/auto/instrumentation/jetty/JettyHandlerInstrumentation.java
@@ -37,11 +37,6 @@ public final class JettyHandlerInstrumentation extends Instrumenter.Default {
super("jetty", "jetty-8");
}
- @Override
- public boolean defaultEnabled() {
- return false;
- }
-
@Override
public ElementMatcher<ClassLoader> classLoaderMatcher() {
// Optimization for expensive typeMatcher.

MODIFY
instrumentation/jetty-8.0/src/test/groovy/JettyHandlerTest.groovy
instrumentation/jetty-8.0/src/test/groovy/JettyHandlerTest.groovy
@@ -37,10 +37,6 @@ import static io.opentelemetry.trace.Span.Kind.SERVER
class JettyHandlerTest extends HttpServerTest<Server> {
- static {
- System.setProperty("ota.integration.jetty.enabled", "true")
- }
-
static errorHandler = new ErrorHandler() {
@Override
protected void handleErrorPage(HttpServletRequest request, Writer writer, int code, String message) throws IOException {

MODIFY
instrumentation/servlet/request-3.0/src/test/groovy/JettyServlet3Test.groovy
instrumentation/servlet/request-3.0/src/test/groovy/JettyServlet3Test.groovy
@@ -29,6 +29,11 @@ import static io.opentelemetry.auto.test.base.HttpServerTest.ServerEndpoint.SUCC
abstract class JettyServlet3Test extends AbstractServlet3Test<Server, ServletContextHandler> {
+ static {
+ //We want to test spans produced by servlet instrumentation, not those of jetty
+ System.setProperty("ota.integration.jetty.enabled", "false")
+ }
+
@Override
boolean testNotFound() {
false

MODIFY
instrumentation/servlet/request-3.0/src/test/groovy/JettyServletHandlerTest.groovy
instrumentation/servlet/request-3.0/src/test/groovy/JettyServletHandlerTest.groovy
@@ -22,6 +22,11 @@ import javax.servlet.http.HttpServletRequest
class JettyServletHandlerTest extends AbstractServlet3Test<Server, ServletHandler> {
+ static {
+ //We want to test spans produced by servlet instrumentation, not those of jetty
+ System.setProperty("ota.integration.jetty.enabled", "false")
+ }
+
@Override
Server startServer(int port) {
Server server = new Server(port)

MODIFY
instrumentation/sparkjava-2.3/src/main/java/io/opentelemetry/auto/instrumentation/sparkjava/RoutesInstrumentation.java
instrumentation/sparkjava-2.3/src/main/java/io/opentelemetry/auto/instrumentation/sparkjava/RoutesInstrumentation.java
@@ -41,11 +41,6 @@ public class RoutesInstrumentation extends Instrumenter.Default {
super("sparkjava", "sparkjava-2.4");
}
- @Override
- public boolean defaultEnabled() {
- return false;
- }
-
@Override
public ElementMatcher<TypeDescription> typeMatcher() {
return named("spark.route.Routes");

MODIFY
instrumentation/sparkjava-2.3/src/test/groovy/SparkJavaBasedTest.groovy
instrumentation/sparkjava-2.3/src/test/groovy/SparkJavaBasedTest.groovy
@@ -27,11 +27,6 @@ import static io.opentelemetry.trace.Span.Kind.SERVER
class SparkJavaBasedTest extends AgentTestRunner {
- static {
- System.setProperty("ota.integration.jetty.enabled", "true")
- System.setProperty("ota.integration.sparkjava.enabled", "true")
- }
-
@Shared
int port

Enable the following instrumentation by default: grizzly, jetty, spark-java (#407)