kiran-maturi commented on a change in pull request #3445: URL: https://github.com/apache/hadoop/pull/3445#discussion_r832102387
########## File path: hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/tracing/Span.java ########## @@ -17,28 +17,54 @@ */ package org.apache.hadoop.tracing; +import io.opentelemetry.context.Scope; + import java.io.Closeable; public class Span implements Closeable { - + private 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() { + if(span != null){ + return new SpanContext(span.getSpanContext()); + } return null; } public void finish() { + close(); } public void close() { + if(span != null){ + span.end(); Review comment: > would span need to be nullified here. or is it ok to invoke it after being ended? I think we need not nullify span after it has ended. In general we call span.end in a finally block so no further operation takes place. If we end the span before that and try adding events or call end it won't have any impact. -- 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: common-issues-unsubscr...@hadoop.apache.org 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