You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eventmesh.apache.org by mi...@apache.org on 2022/07/21 02:11:39 UTC

[incubator-eventmesh] branch master updated: [Bug]Fix the case that span is null

This is an automated email from the ASF dual-hosted git repository.

mikexue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-eventmesh.git


The following commit(s) were added to refs/heads/master by this push:
     new 84a8bafb [Bug]Fix the case that span is null
     new 6c61197c Merge pull request #1020 from liuzwei/fix_bug_span_npe
84a8bafb is described below

commit 84a8bafba2c2e9d5bc858cca7b1a526b9738f615
Author: liuzwei <li...@163.com>
AuthorDate: Wed Jul 13 21:21:14 2022 +0800

    [Bug]Fix the case that span is null
---
 .../src/main/java/org/apache/eventmesh/runtime/trace/Trace.java     | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/trace/Trace.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/trace/Trace.java
index f1d94cde..716577f8 100644
--- a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/trace/Trace.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/trace/Trace.java
@@ -36,7 +36,7 @@ import io.opentelemetry.context.Context;
 public class Trace {
     private final Logger logger = LoggerFactory.getLogger(this.getClass());
 
-    private boolean useTrace = false;
+    private final boolean useTrace;
     private EventMeshTraceService eventMeshTraceService;
 
     public Trace(boolean useTrace) {
@@ -53,7 +53,7 @@ public class Trace {
     public Span createSpan(String spanName, SpanKind spanKind, long startTime, TimeUnit timeUnit,
                            Context context, boolean isSpanFinishInOtherThread) {
         if (!useTrace) {
-            return null;
+            return Span.getInvalid();
         }
         return eventMeshTraceService.createSpan(spanName, spanKind, startTime, timeUnit, context,
             isSpanFinishInOtherThread);
@@ -62,7 +62,7 @@ public class Trace {
     public Span createSpan(String spanName, SpanKind spanKind, Context context,
                            boolean isSpanFinishInOtherThread) {
         if (!useTrace) {
-            return null;
+            return Span.getInvalid();
         }
         return eventMeshTraceService.createSpan(spanName, spanKind, context,
             isSpanFinishInOtherThread);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: commits-help@eventmesh.apache.org