Pil0tXia commented on code in PR #3632:
URL: https://github.com/apache/eventmesh/pull/3632#discussion_r1637247124


##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/trace/Trace.java:
##########
@@ -111,7 +112,17 @@ public Span addTraceInfoToSpan(ChannelHandlerContext ctx, 
CloudEvent cloudEvent)
         }
         Context context = 
ctx.channel().attr(AttributeKeys.SERVER_CONTEXT).get();
         Span span = context != null ? context.get(SpanKey.SERVER_KEY) : null;
-        return addTraceInfoToSpan(span, cloudEvent);
+
+        if (span == null) {
+            log.warn("span is null when finishSpan");
+            return null;
+        }
+
+        //add trace info
+        for (String entry : cloudEvent.getExtensionNames()) {
+            span.setAttribute(entry, cloudEvent.getExtension(entry) == null ? 
"" : Objects.requireNonNull(cloudEvent.getExtension(entry)).toString());
+        }
+        return span;

Review Comment:
   Excuse me for overlooking some folded context earlier. I initially intended 
to point out that the `addTraceInfoToSpan` method should not be inlined here. 
However, it appears that further review is unnecessary as the issue 
corresponding to this PR is invalid. I will close the issue and label this PR 
as `invalid`.
   
   @harshithasudhakar Thank you very much for your contribution. Please feel 
free to select other valuable issues to work on.



-- 
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: issues-unsubscr...@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to