Closed avifro-dev closed 3 years ago
The class JdbcTracingUtils
is not public so you can't change it easily.
Until this is resolved, here's the workaround
final Field slowQueryThresholdMs = Class.forName("io.opentracing.contrib.jdbc.JdbcTracingUtils").getField("slowQueryThresholdMs");
slowQueryThresholdMs.setAccessible(true);
slowQueryThresholdMs.set(null, 100);
It's well documented that it's possible to change
slowQueryThresholdMs
value by code, as it's public static variable. For example as in the below example:io.opentracing.contrib.jdbc.JdbcTracingUtils.slowQueryThresholdMs = 100
Unfortunately, the class containing this static variable has a package scope (JdbcTracingUtils
), so I'm afraid it's not possible to do so. The only way of setting this value is just via setting environment variable, but didn't find any way to do it dynamically. Maybe I'm missing here something?