Suppressing specific instrumentation

Disabling the agent entirely

System property: otel.javaagent.enabledEnvironment variable: OTEL_JAVAAGENT_ENABLED

Description: Set the value to false to disable the agent entirely.

Enable only specific instrumentation

You can disable all default auto instrumentation and selectively re-enable individual instrumentation. This may be desirable to reduce startup overhead or to have more control of which instrumentation is applied.

System property: otel.instrumentation.common.default-enabledEnvironment variable: OTEL_INSTRUMENTATION_COMMON_DEFAULT_ENABLED

Description: Set to false to disable all instrumentation in the agent.

System property: otel.instrumentation.[name].enabledEnvironment variable: OTEL_INSTRUMENTATION_[NAME]_ENABLED

Description: Set to true to enable each desired instrumentation individually.

Note: Some instrumentation relies on other instrumentation to function properly. When selectively enabling instrumentation, be sure to enable the transitive dependencies too. Determining this dependency relationship is left as an exercise to the user.

Enable manual instrumentation only

You can suppress all auto instrumentations but have support for manual instrumentation with @WithSpan and normal API interactions by using -Dotel.instrumentation.common.default-enabled=false -Dotel.instrumentation.opentelemetry-api.enabled=true -Dotel.instrumentation.opentelemetry-instrumentation-annotations.enabled=true

Suppressing specific agent instrumentation

You can suppress agent instrumentation of specific libraries.

System property: otel.instrumentation.[name].enabledEnvironment variable: OTEL_INSTRUMENTATION_[NAME]_ENABLED

Description: Set to false to suppress agent instrumentation of specific libraries, where [name] is the corresponding instrumentation name:

Library/FrameworkInstrumentation name
Additional methods tracingmethods
Additional tracing annotationsexternal-annotations
Akka Actorakka-actor
Akka HTTPakka-http
Apache Axis2axis2
Apache Camelcamel
Apache Cassandracassandra
Apache CXFcxf
Apache DBCPapache-dbcp
Apache Dubboapache-dubbo
Apache Geodegeode
Apache HttpAsyncClientapache-httpasyncclient
Apache HttpClientapache-httpclient
Apache Kafkakafka
Apache MyFacesjsf-myfaces
Apache Pekko Actorpekko-actor
Apache Pekko HTTPpekko-http
Apache Pulsarpulsar
Apache RocketMQrocketmq-client
Apache Shenyuapache-shenyu
Apache Struts 2struts
Apache Tapestrytapestry
Apache Tomcattomcat
Apache Wicketwicket
Armeriaarmeria
AsyncHttpClient (AHC)async-http-client
AWS Lambdaaws-lambda
AWS SDKaws-sdk
Azure SDKazure-core
Clickhouse Clientclickhouse
Couchbasecouchbase
C3P0c3p0
Dropwizard Viewsdropwizard-views
Dropwizard Metricsdropwizard-metrics
Eclipse Grizzlygrizzly
Eclipse Jerseyjersey
Eclipse Jettyjetty
Eclipse Jetty HTTP Clientjetty-httpclient
Eclipse Metrometro
Eclipse Mojarrajsf-mojarra
Eclipse Vert.x HttpClientvertx-http-client
Eclipse Vert.x Kafka Clientvertx-kafka-client
Eclipse Vert.x Redis Clientvertx-redis-client
Eclipse Vert.x RxJavavertx-rx-java
Eclipse Vert.x SQL Clientvertx-sql-client
Eclipse Vert.x Webvertx-web
Elasticsearch clientelasticsearch-transport
Elasticsearch REST clientelasticsearch-rest
Finaglefinagle-http
Google Guavaguava
Google HTTP clientgoogle-http-client
Google Web Toolkitgwt
Grailsgrails
GraphQL Javagraphql-java
GRPCgrpc
Hibernatehibernate
Hibernate Reactivehibernate-reactive
HikariCPhikaricp
InfluxDBinfluxdb
Java HTTP Clientjava-http-client
Java HttpURLConnectionhttp-url-connection
Java JDBCjdbc
Java JDBC DataSourcejdbc-datasource
Java RMIrmi
Java Runtimeruntime-telemetry
Java Servletservlet
java.util.concurrentexecutors
java.util.loggingjava-util-logging
Javalinjavalin
JAX-RS (Client)jaxrs-client
JAX-RS (Server)jaxrs
JAX-WSjaxws
JBoss Logging Appenderjboss-logmanager-appender
JBoss Logging MDCjboss-logmanager-mdc
JMSjms
Jodd HTTPjodd-http
JSPjsp
K8s Clientkubernetes-client
Ktorktor
kotlinx.coroutineskotlinx-coroutines
Log4j Appenderlog4j-appender
Log4j MDC (1.x)log4j-mdc
Log4j Context Data (2.x)log4j-context-data
Logback Appenderlogback-appender
Logback MDClogback-mdc
Micrometermicrometer
MongoDBmongo
MyBatismybatis
Netflix Hystrixhystrix
Nettynetty
OkHttpokhttp
OpenLibertyliberty
OpenTelemetry Extension Annotationsopentelemetry-extension-annotations
OpenTelemetry Instrumentation Annotationsopentelemetry-instrumentation-annotations
OpenTelemetry APIopentelemetry-api
Oracle UCPoracle-ucp
OSHI (Operating System and Hardware Information)oshi
Play Frameworkplay
Play WS HTTP Clientplay-ws
Quarkusquarkus
Quartzquartz
R2DBCr2dbc
RabbitMQ Clientrabbitmq
Ratpackratpack
ReactiveX RxJavarxjava
Reactorreactor
Reactor Kafkareactor-kafka
Reactor Nettyreactor-netty
Redis Jedisjedis
Redis Lettucelettuce
Rediscalarediscala
Redissonredisson
Restletrestlet
Scala ForkJoinPoolscala-fork-join
Spark Web Frameworkspark
Spring Batchspring-batch
Spring Corespring-core
Spring Dataspring-data
Spring JMSspring-jms
Spring Integrationspring-integration
Spring Kafkaspring-kafka
Spring RabbitMQspring-rabbit
Spring RMIspring-rmi
Spring Schedulingspring-scheduling
Spring Webspring-web
Spring WebFluxspring-webflux
Spring Web MVCspring-webmvc
Spring Web Servicesspring-ws
Spymemcachedspymemcached
Tomcat JDBCtomcat-jdbc
Twilio SDKtwilio
Twitter Finatrafinatra
Undertowundertow
Vaadinvaadin
Vibur DBCPvibur-dbcp
XXL-JOBxxl-job
ZIOzio

Note: When using environment variables, dashes (-) should be converted to underscores (_). For example, to suppress traces from akka-actor library, set OTEL_INSTRUMENTATION_AKKA_ACTOR_ENABLED to false.

Suppressing controller and/or view spans

Some instrumentations (e.g. Spring Web MVC instrumentation) produce SpanKind.Internal spans to capture the controller and/or view execution. These spans can be suppressed using the configuration settings below, without suppressing the entire instrumentation which would also disable the instrumentation’s capturing of http.route and associated span name on the parent SpanKind.Server span.

System property: otel.instrumentation.common.experimental.controller-telemetry.enabledEnvironment variable: OTEL_INSTRUMENTATION_COMMON_EXPERIMENTAL_CONTROLLER_TELEMETRY_ENABLED

Default: false
Description: Set to true to enable controller telemetry.

System property: otel.instrumentation.common.experimental.view-telemetry.enabledEnvironment variable: OTEL_INSTRUMENTATION_COMMON_EXPERIMENTAL_VIEW_TELEMETRY_ENABLED

Default: false
Description: Set to true to enable view telemetry.

Instrumentation span suppression behavior

Some libraries that this agent instruments in turn use lower-level libraries, that are also instrumented. This would normally result in nested spans containing duplicate telemetry data. For example:

  • Spans produced by the Reactor Netty HTTP client instrumentation would have duplicate HTTP client spans produced by the Netty instrumentation;
  • Dynamo DB spans produced by the AWS SDK instrumentation would have children HTTP client spans produced by its internal HTTP client library (which is also instrumented);
  • Spans produced by the Tomcat instrumentation would have duplicate HTTP server spans produced by the generic Servlet API instrumentation.

The Java agent prevents these situations by detecting and suppressing nested spans that duplicate telemetry data. The suppression behavior can be configured using the following configuration option:

System property: otel.instrumentation.experimental.span-suppression-strategyEnvironment variable: OTEL_INSTRUMENTATION_EXPERIMENTAL_SPAN_SUPPRESSION_STRATEGY

Description: The Java agent span suppression strategy. The following 3 strategies are supported:

  • semconv: The agent will suppress duplicate semantic conventions. This is the default behavior of the Java agent.
  • span-kind: The agent will suppress spans with the same kind (except INTERNAL).
  • none: The agent will not suppress anything at all. We do not recommend using this option for anything other than debug purposes, as it generates lots of duplicate telemetry data.

For example, suppose we instrument a database client which internally uses the Reactor Netty HTTP client; which in turn uses Netty.

Using the default semconv suppression strategy would result in 2 nested CLIENT spans:

  • CLIENT span with database client semantic attributes emitted by the database client instrumentation;
  • CLIENT span with HTTP client semantic attributes emitted by the Reactor Netty instrumentation.

The Netty instrumentation would be suppressed, as it duplicates the Reactor Netty HTTP client instrumentation.

Using the suppression strategy span-kind would result in just one span:

  • CLIENT span with database client semantic attributes emitted by the database client instrumentation.

Both Reactor Netty and Netty instrumentations would be suppressed, as they also emit CLIENT spans.

Finally, using the suppression strategy none would result in 3 spans:

  • CLIENT span with database client semantic attributes emitted by the database client instrumentation;
  • CLIENT span with HTTP client semantic attributes emitted by the Reactor Netty instrumentation;
  • CLIENT span with HTTP client semantic attributes emitted by the Netty instrumentation.