steveloughran commented on a change in pull request #2816:
URL: https://github.com/apache/hadoop/pull/2816#discussion_r601307384



##########
File path: hadoop-common-project/hadoop-common/pom.xml
##########
@@ -371,6 +371,31 @@
       <artifactId>lz4-java</artifactId>
       <scope>provided</scope>
     </dependency>
+    <dependency>
+      <groupId>io.opentelemetry</groupId>
+      <artifactId>opentelemetry-api</artifactId>
+      <version>1.0.0</version>

Review comment:
       all these imports 
   1. need to be declared in hadoop-project/pom.xml
   2. and if the api and sdk are to be kept in sync, with the version defined 
in a property
   3. The hadoop-common import should declare as <provided> all those only 
needed for build and test.

##########
File path: 
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/tracing/Span.java
##########
@@ -17,28 +17,51 @@
  */
 package org.apache.hadoop.tracing;
 
+import io.opentelemetry.context.Scope;
+
 import java.io.Closeable;
 
 public class Span implements Closeable {
-
+  io.opentelemetry.api.trace.Span span = null;
   public Span() {
   }
 
+  public Span(io.opentelemetry.api.trace.Span span){
+    this.span = span;
+  }
+
   public Span addKVAnnotation(String key, String value) {
+    if(span != null){
+      span.setAttribute(key, value);
+    }
     return this;
   }
 
   public Span addTimelineAnnotation(String msg) {
+    if(span != null){
+      span.addEvent(msg);
+    }
     return this;
   }
 
   public SpanContext getContext() {
-    return null;
+    return  new SpanContext(span.getSpanContext());
   }
 
   public void finish() {
+    close();
   }
 
   public void close() {
+    if(span != null){
+      span.end();

Review comment:
       set span to null, presumably

##########
File path: 
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/tracing/Span.java
##########
@@ -17,28 +17,51 @@
  */
 package org.apache.hadoop.tracing;
 
+import io.opentelemetry.context.Scope;
+
 import java.io.Closeable;
 
 public class Span implements Closeable {
-
+  io.opentelemetry.api.trace.Span span = null;
   public Span() {
   }
 
+  public Span(io.opentelemetry.api.trace.Span span){
+    this.span = span;
+  }
+
   public Span addKVAnnotation(String key, String value) {
+    if(span != null){
+      span.setAttribute(key, value);
+    }
     return this;
   }
 
   public Span addTimelineAnnotation(String msg) {
+    if(span != null){
+      span.addEvent(msg);
+    }
     return this;
   }
 
   public SpanContext getContext() {
-    return null;
+    return  new SpanContext(span.getSpanContext());

Review comment:
       what if span == null

##########
File path: 
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/tracing/Span.java
##########
@@ -17,28 +17,51 @@
  */
 package org.apache.hadoop.tracing;
 
+import io.opentelemetry.context.Scope;
+
 import java.io.Closeable;
 
 public class Span implements Closeable {
-
+  io.opentelemetry.api.trace.Span span = null;

Review comment:
       private




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



---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to