adoroszlai commented on code in PR #10569:
URL: https://github.com/apache/ozone/pull/10569#discussion_r3450441666


##########
hadoop-ozone/cli-shell/src/main/java/org/apache/hadoop/ozone/shell/Shell.java:
##########
@@ -101,7 +101,12 @@ private int execute(CommandLine.ParseResult parseResult) {
 
     TracingUtil.initTracing("shell", getOzoneConf());
     String spanName = spec.name() + " " + String.join(" ", 
parseResult.originalArgs());
-    return TracingUtil.executeInNewSpan(spanName, () -> new 
CommandLine.RunLast().execute(parseResult));
+    try {
+      return TracingUtil.executeInNewSpan(spanName,
+          () -> new CommandLine.RunLast().execute(parseResult));
+    } finally {
+      TracingUtil.flushTracing();
+    }

Review Comment:
   It would be nice to extract a new method in `TracingUtil` for single spans 
in CLI:
   
   ```java
     public static <R, E extends Exception> R execute(
         String serviceName,
         String spanName,
         ConfigurationSource conf,
         CheckedSupplier<R, E> supplier
     ) {
       initTracing(serviceName, conf);
       try {
         return executeInNewSpan(spanName, supplier);
       } finally {
         flushTracing();
       }
     }
   ```



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