You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2020/04/17 11:23:28 UTC

[GitHub] [hadoop-ozone] elek commented on a change in pull request #835: HDDS-3399. Update JaegerTracing

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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org