You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2020/03/08 06:59:20 UTC

[skywalking] branch exist-span-inject updated: Close the set component id for exit and local spans

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

wusheng pushed a commit to branch exist-span-inject
in repository https://gitbox.apache.org/repos/asf/skywalking.git


The following commit(s) were added to refs/heads/exist-span-inject by this push:
     new 05a4e68  Close the set component id for exit and local spans
05a4e68 is described below

commit 05a4e684dd30454894b4c2e10c9785ba63141d62
Author: Wu Sheng <wu...@foxmail.com>
AuthorDate: Sun Mar 8 14:58:58 2020 +0800

    Close the set component id for exit and local spans
---
 .../apache/skywalking/apm/agent/core/context/trace/ExitSpan.java | 9 ++++-----
 .../skywalking/apm/agent/core/context/trace/LocalSpan.java       | 8 ++++++++
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/ExitSpan.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/ExitSpan.java
index f9b65e8..e414257 100644
--- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/ExitSpan.java
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/ExitSpan.java
@@ -118,13 +118,12 @@ public class ExitSpan extends StackBasedTracingSpan implements ExitTypeSpan {
         }
     }
 
+    /**
+     * Illegal operation. Operation name id is the registered endpoint, only work for entry span.
+     */
     @Override
     public AbstractTracingSpan setOperationId(int operationId) {
-        if (stackDepth == 1) {
-            return super.setOperationId(operationId);
-        } else {
-            return this;
-        }
+        throw new UnsupportedOperationException("Exit span doesn't support operation id");
     }
 
     @Override
diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/LocalSpan.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/LocalSpan.java
index 292f53d..91bc47f 100644
--- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/LocalSpan.java
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/LocalSpan.java
@@ -47,4 +47,12 @@ public class LocalSpan extends AbstractTracingSpan {
     public AbstractSpan setPeer(String remotePeer) {
         return this;
     }
+
+    /**
+     * Illegal operation. Operation name id is the registered endpoint, only work for entry span.
+     */
+    @Override
+    public AbstractTracingSpan setOperationId(int operationId) {
+        throw new UnsupportedOperationException("Exit span doesn't support operation id");
+    }
 }