elek commented on a change in pull request #835: HDDS-3399. Update JaegerTracing
URL: https://github.com/apache/hadoop-ozone/pull/835#discussion_r410160098
 
 

 ##########
 File path: 
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/tracing/TracingUtil.java
 ##########
 @@ -129,8 +132,53 @@ private static SpanContext extractParent(String parent, 
Tracer tracer) {
   private static boolean isTracingEnabled(
       org.apache.hadoop.conf.Configuration conf) {
     return conf.getBoolean(
-          ScmConfigKeys.HDDS_TRACING_ENABLED,
-          ScmConfigKeys.HDDS_TRACING_ENABLED_DEFAULT);
+        ScmConfigKeys.HDDS_TRACING_ENABLED,
+        ScmConfigKeys.HDDS_TRACING_ENABLED_DEFAULT);
+  }
+
+  /**
+   * Execute a new function inside an activated span.
+   */
+  public static <R> R executeInsideNewSpan(String spanName,
+      SupplierWithIOException<R> supplier)
+      throws IOException {
+    Span span = GlobalTracer.get()
+        .buildSpan(spanName).start();
+    try (Scope scope = GlobalTracer.get().activateSpan(span)) {
+      return supplier.get();
+    } catch (Exception ex) {
+      span.setTag("failed", true);
+      throw ex;
+    }
 
 Review comment:
   Thanks to test it @adoroszlai . I didn't notice any problem with the spans 
when I tested, but yes, it seems to be missing. Added them.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to