Auto-Instrumentation

OpenTelemetry automatically provides instrumentation for a large number of libraries and frameworks, right out of the box.

Supported Java libraries and frameworks

Library/FrameworkVersions
Akka HTTP10.0+
Apache HttpAsyncClient4.0+
Apache HttpClient2.0+
Armeria0.99.8+
AWS SDK1.11.x and 2.2.0+
Cassandra Driver3.0+
Couchbase Client2.0+ (not including 3.x yet)
Dropwizard Views0.7+
Elasticsearch API2.0+ (not including 7.x yet)
Elasticsearch REST Client5.0+
Finatra2.9+
Geode Client1.4+
Google HTTP Client1.19+
Grizzly2.0+ (disabled by default, see below)
Grizzly Client1.9+
gRPC1.5+
Hibernate3.3+
HttpURLConnectionJava 7+
Hystrix1.4+
JAX-RS0.5+
JAX-RS Client2.0+
JDBCJava 7+
Jedis1.4+
Jetty8.0+
JMS1.1+
JSP2.3+
Kafka0.11+
khttp0.1+
Kubernetes Client7.0+
Lettuce4.0+
MongoDB Drivers3.3+
Netty3.8+
OkHttp3.0+
Play2.3+ (not including 2.8.x yet)
Play WS1.0+
RabbitMQ Client2.7+
Ratpack1.4+
Reactor3.1+
Rediscala1.8+
RMIJava 7+
RxJava1.0+
Servlet2.2+
Spark Web Framework2.3+
Spring Data1.8+
Spring Scheduling3.1+
Spring Web MVC3.1+
Spring Webflux5.0+
Spymemcached2.12+
Twilio6.6+
Vert.x3.0+
Vert.x RxJava23.5+

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 otel.integration.<name>.enabled system property: -Dotel.integration.jdbc-datasource.enabled=true

Grizzly instrumentation

Whenever you use Grizzly 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: -Dotel.integration.grizzly.enabled=true

Suppressing specific auto-instrumentation

You can suppress auto-instrumentation of specific libraries by using -Dota.integration.[id].enabled=true, where id is the instrumentation id.

Even more fine-grained control

You can also exclude specific classes from being instrumented.

This can be useful to completely silence spans from a given class/package.

Or as a quick workaround for an instrumentation bug, when byte code in one specific class is problematic.

This option should not be used lightly, as it can leave some instrumentation partially applied, which could have unknown side-effects.

If you find yourself needing to use this, it would be great if you could drop us an issue explaining why, so that we can try to come up with a better solution to address your need.

System propertyEnvironment variablePurpose
trace.classes.excludeTRACE_CLASSES_EXCLUDESuppresses all instrumentation for specific classes, format is "my.package.MyClass,my.package2.*"