rajeshkumarchandolu commented on code in PR #11607:
URL: https://github.com/apache/ozone/pull/11607#discussion_r4375536925
##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/tracing/TracingUtil.java:
##########
@@ -62,11 +65,29 @@ public final class TracingUtil {
private static Tracer tracer = OpenTelemetry.noop().getTracer("noop");
private static volatile SdkTracerProvider sdkTracerProvider;
private static BatchSpanProcessor batchSpanProcessor;
+ private static boolean mdcContextStorageInstalled;
public static final String GLOBAL_TRACER_NAME = "ozone";
private TracingUtil() {
}
+ /**
+ * Adds the current trace and span IDs to the logging MDC.
+ * Only for Ozone services and CLIs, not the client library, so applications
keep their own MDC.
+ * Must be called before OpenTelemetry {@link Context} is first used in the
JVM.
+ */
+ public static synchronized void installMdcContextStorage() {
+ if (mdcContextStorageInstalled) {
+ return;
+ }
+ mdcContextStorageInstalled = true;
+ ContextStorage.addWrapper(MdcContextStorage::new);
Review Comment:
Added TestMdcContextStorageInstall. It installs the storage globally and
fails if addWrapper is removed.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]