sumitagrawl commented on code in PR #10477:
URL: https://github.com/apache/ozone/pull/10477#discussion_r3556970503


##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/tracing/TracingUtil.java:
##########
@@ -85,14 +96,83 @@ public static synchronized void initTracing(
     initTracing(serviceName, conf.getObject(TracingConfig.class));
   }
 
+  /**
+   * If the host application already registered OpenTelemetry globally and
+   * application-aware is on, we reuse that tracer and add child spans only.
+   * Otherwise, if ozone.tracing.enabled is true, Ozone starts its own tracer.
+   * If neither applies, tracing stays off.
+   */
+  public static synchronized void initClientTracing(

Review Comment:
   no need have separte init for client/server, 
   if tracing.enabled=true
     if global configured, use this
     else if ozone configured, use this value
     else no-ops
   else if client-aware=true
     if global configured, use this
     else if ozone configured, use this
   
   Also, always set service name to OpenTelemen Global and same for tracer.
   
   impact to client: client no impact
   
   impact to server:
   reconfig: reprioritize to ozone and set again global name and tracer



##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/tracing/TracingUtil.java:
##########
@@ -292,6 +402,10 @@ private static <R, E extends Exception> R 
executeInSpan(Span span,
    */
   private static <E extends Exception> void executeInSpan(Span span,
       CheckedRunnable<E> runnable) throws E {
+    if (!span.getSpanContext().isValid()) {

Review Comment:
   need not have a check of isValid() as Span with invalid is like a noops span.



##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/tracing/TracingUtil.java:
##########
@@ -54,6 +56,15 @@ public final class TracingUtil {
   private static volatile boolean isInit = false;
   private static Tracer tracer = OpenTelemetry.noop().getTracer("noop");
   private static SdkTracerProvider sdkTracerProvider;
+  private static volatile Mode mode = Mode.NOOP;
+
+  /**
+   * NOOP — tracing off.
+   * OZONE — Ozone-owned tracing ({@code ozone.tracing.enabled=true}).
+   * APPLICATION — continue an existing trace only; never start roots.
+   */
+
+  private enum Mode { NOOP, OZONE, APPLICATION }

Review Comment:
   no need define mode



-- 
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]

Reply via email to