Search code examples
javajdbcquartzopen-telemetry

How to suppress opentelemetry java auto instrumentation for some calls


I use opentelemetry java agent for tracing. It provides auto instrumentation for JDBC calls. Recently I added the quartz java library. It provides a lot of traces when the quartz makes internal requests to DB.

I wonder if there is a way to suppress particular traces? I don't want to disable auto instrumentation for all JDBC calls.

UPDATED

I tried -Dotel.instrumentation.quartz.enabled=false, but it just disables the job execution traces, but jdbc calls still appear.

I tried -Dotel.javaagent.exclude-classes=, but it's definitely hard to identify which class of quartz I need to put here to suppress the jdbc calls.


Solution

  • To fix this behavior, we disabled auto instrumentation for quartz:

    -Dotel.instrumentation.quartz.enabled=false
    

    and provided our own extension with a sampler to identify which span is provided by quartz. More information about the extension you can find in this official example https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/examples/extension