dlmarion commented on a change in pull request #2363:
URL: https://github.com/apache/accumulo/pull/2363#discussion_r753200841
##########
File path: core/src/main/java/org/apache/accumulo/core/trace/TraceUtil.java
##########
@@ -56,97 +52,32 @@
private static final String SPAN_FORMAT = "%s::%s";
- private static Tracer instance = null;
- private static boolean tracing = false;
+ private static volatile boolean enabled = true;
- private static void initializeInternals(OpenTelemetry ot) {
- instance = ot.getTracer(APPNAME, VERSION);
- tracing = !ot.equals(OpenTelemetry.noop());
- LOG.info("Trace enabled: {}, OpenTelemetry instance: {}, Tracer instance:
{}", tracing,
- ot.getClass(), instance.getClass());
+ public static void initializeTracer(AccumuloConfiguration conf) {
+ enabled = conf.getBoolean(Property.GENERAL_OPENTELEMETRY_ENABLED);
+ LOG.info("Trace enabled: {}, OpenTelemetry instance: {}, Tracer instance:
{}", enabled,
Review comment:
In testing I set `general.opentelemetry.enabled` to `true`, but did not
have the java agent jar or any other OpenTelemetry jar on the classpath. It
still logged that trace was enabled. I think in this method and in `enable()`
we need to also test whether the result of `getOpenTelemetry()` is equal to
`OpenTelemetry.noop()`. We should probably consolidate the logging in
`initializeTracer`, `enable`, and `disable` to one method. Something like:
```
private static void logMsg() {
boolean isEnabled = enabled &&
(!getOpenTelemetry().equals(OpenTelemetry.noop());
LOG.info("Trace enabled: {}, OpenTelemetry instance: {}, Tracer instance:
{}", isEnabled,
getOpenTelemetry().getClass(), getTracer().getClass());
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]