wu-sheng commented on code in PR #689:
URL: https://github.com/apache/skywalking-java/pull/689#discussion_r1600845711


##########
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/IgnoredTracerContext.java:
##########
@@ -34,14 +34,21 @@ public class IgnoredTracerContext implements 
AbstractTracerContext {
     private static final NoopSpan NOOP_SPAN = new NoopSpan();
     private static final String IGNORE_TRACE = "Ignored_Trace";
 
+    private LinkedList<AbstractSpan> activeSpanStack;
+
     private final CorrelationContext correlationContext;
     private final ExtensionContext extensionContext;
     private final ProfileStatusContext profileStatusContext;
 
-    private int stackDepth;
-
     public IgnoredTracerContext() {
-        this.stackDepth = 0;
+        this.activeSpanStack = new LinkedList<>();
+        this.correlationContext = new CorrelationContext();
+        this.extensionContext = new ExtensionContext();
+        this.profileStatusContext = ProfileStatusContext.createWithNone();
+    }
+
+    public IgnoredTracerContext(LinkedList<AbstractSpan> activeSpanStack) {
+        this.activeSpanStack = activeSpanStack;

Review Comment:
   We only need the depth to be initialized based on stack depth, rather than 
holding all



##########
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/IgnoredTracerContext.java:
##########
@@ -84,34 +91,35 @@ public int getSpanId() {
 
     @Override
     public AbstractSpan createEntrySpan(String operationName) {
-        stackDepth++;
+        activeSpanStack.addLast(NOOP_SPAN);

Review Comment:
   We just need depth, no further.



##########
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/IgnoredTracerContext.java:
##########
@@ -34,14 +34,21 @@ public class IgnoredTracerContext implements 
AbstractTracerContext {
     private static final NoopSpan NOOP_SPAN = new NoopSpan();
     private static final String IGNORE_TRACE = "Ignored_Trace";
 
+    private LinkedList<AbstractSpan> activeSpanStack;

Review Comment:
   Why need this?



##########
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/IgnoredTracerContext.java:
##########
@@ -34,14 +34,21 @@ public class IgnoredTracerContext implements 
AbstractTracerContext {
     private static final NoopSpan NOOP_SPAN = new NoopSpan();
     private static final String IGNORE_TRACE = "Ignored_Trace";
 
+    private LinkedList<AbstractSpan> activeSpanStack;
+
     private final CorrelationContext correlationContext;
     private final ExtensionContext extensionContext;
     private final ProfileStatusContext profileStatusContext;
 
-    private int stackDepth;
-
     public IgnoredTracerContext() {
-        this.stackDepth = 0;
+        this.activeSpanStack = new LinkedList<>();
+        this.correlationContext = new CorrelationContext();
+        this.extensionContext = new ExtensionContext();
+        this.profileStatusContext = ProfileStatusContext.createWithNone();

Review Comment:
   You just need to call new constructor.



##########
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/IgnoredTracerContext.java:
##########
@@ -84,34 +91,35 @@ public int getSpanId() {
 
     @Override
     public AbstractSpan createEntrySpan(String operationName) {
-        stackDepth++;
+        activeSpanStack.addLast(NOOP_SPAN);

Review Comment:
   All logic here should not be changed.



-- 
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: notifications-unsubscr...@skywalking.apache.org

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

Reply via email to