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

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


The following commit(s) were added to refs/heads/main by this push:
     new 7a9dea8  Fix wrong tracing context switch when trace ignore plugin 
activated (#237)
7a9dea8 is described below

commit 7a9dea85ce1accc5bccffc0b8cc0bf8efce0f32d
Author: mrproliu <[email protected]>
AuthorDate: Sun Jan 4 13:48:37 2026 +0800

    Fix wrong tracing context switch when trace ignore plugin activated (#237)
---
 .github/workflows/windows-plugin-test.yaml       |  2 +-
 CHANGES.md                                       |  1 +
 plugins/core/tracing.go                          | 16 +++++++-------
 test/plugins/scenarios/so11y/config/excepted.yml | 27 ++++++++++++++++++------
 4 files changed, 31 insertions(+), 15 deletions(-)

diff --git a/.github/workflows/windows-plugin-test.yaml 
b/.github/workflows/windows-plugin-test.yaml
index e4f3c92..b1745f8 100644
--- a/.github/workflows/windows-plugin-test.yaml
+++ b/.github/workflows/windows-plugin-test.yaml
@@ -87,7 +87,7 @@ jobs:
           
           sudo service docker start
           
-          curl -SL 
https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-linux-x86_64
 -o /usr/local/bin/docker-compose
+          curl -SL 
https://github.com/docker/compose/releases/download/v2.24.5/docker-compose-linux-x86_64
 -o /usr/local/bin/docker-compose
           sudo chmod +x /usr/local/bin/docker-compose
           docker-compose --version
       - name: WSL – Install Go 1.19
diff --git a/CHANGES.md b/CHANGES.md
index 0825750..57f0ccb 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -18,6 +18,7 @@ Release Notes.
 #### Bug Fixes
 
 * Fix plugin interceptors bypassed on Windows.
+* Fix wrong tracing context switch when trace ignore plugin activated.
 
 #### Issues and PR
 - All issues are 
[here](https://github.com/apache/skywalking/milestone/238?closed=1)
diff --git a/plugins/core/tracing.go b/plugins/core/tracing.go
index b11d4e0..3cddf2c 100644
--- a/plugins/core/tracing.go
+++ b/plugins/core/tracing.go
@@ -266,14 +266,6 @@ func (s *ContextSnapshot) IsValid() bool {
 }
 
 func (t *Tracer) createNoop(operationName string) (*TracingContext, 
TracingSpan, bool) {
-       if !t.InitSuccess() || t.Reporter.ConnectionStatus() == 
reporter.ConnectionStatusDisconnect {
-               GetSo11y(t).MeasureTracingContextCreation(false, true)
-               return nil, newNoopSpan(t), true
-       }
-       if tracerIgnore(operationName, t.ignoreSuffix, t.traceIgnorePath) {
-               GetSo11y(t).MeasureTracingContextCreation(false, true)
-               return nil, newNoopSpan(t), true
-       }
        ctx := getTracingContext()
        if ctx != nil {
                span := ctx.ActiveSpan()
@@ -284,6 +276,14 @@ func (t *Tracer) createNoop(operationName string) 
(*TracingContext, TracingSpan,
                }
                return ctx, span, ok
        }
+       if !t.InitSuccess() || t.Reporter.ConnectionStatus() == 
reporter.ConnectionStatusDisconnect {
+               GetSo11y(t).MeasureTracingContextCreation(false, true)
+               return nil, newNoopSpan(t), true
+       }
+       if tracerIgnore(operationName, t.ignoreSuffix, t.traceIgnorePath) {
+               GetSo11y(t).MeasureTracingContextCreation(false, true)
+               return nil, newNoopSpan(t), true
+       }
        ctx = NewTracingContext()
        return ctx, nil, false
 }
diff --git a/test/plugins/scenarios/so11y/config/excepted.yml 
b/test/plugins/scenarios/so11y/config/excepted.yml
index c60ca7e..6023211 100644
--- a/test/plugins/scenarios/so11y/config/excepted.yml
+++ b/test/plugins/scenarios/so11y/config/excepted.yml
@@ -56,6 +56,21 @@ segmentItems:
               - { key: http.method, value: GET }
               - { key: url, value: 'localhost:8080/propagated' }
               - { key: status_code, value: '200' }
+          - operationName: GET:/ignored.html
+            parentSpanId: 0
+            spanId: 2
+            spanLayer: Http
+            startTime: nq 0
+            endTime: nq 0
+            componentId: 5005
+            isError: false
+            spanType: Exit
+            peer: localhost:8080
+            skipAnalysis: false
+            tags:
+              - { key: http.method, value: GET }
+              - { key: url, value: 'localhost:8080/ignored.html' }
+              - { key: status_code, value: '200' }
           - operationName: GET:/so11y
             parentSpanId: -1
             spanId: 0
@@ -81,13 +96,13 @@ meterItems:
             - {name: source, value: ignore}
         singleValue: 0.0
       - meterId:
-          name: sw_go_finished_tracing_context_counter
+          name: sw_go_finished_ignored_context_counter
           tags: []
-        singleValue: 4.0
+        singleValue: 0.0
       - meterId:
-          name: sw_go_finished_ignored_context_counter
+          name: sw_go_finished_tracing_context_counter
           tags: []
-        singleValue: 2.0
+        singleValue: 6.0
       - meterId:
           name: sw_go_tracing_context_performance
           tags: []
@@ -106,7 +121,7 @@ meterItems:
           name: sw_go_created_ignored_context_counter
           tags:
             - {name: created_by, value: sampler}
-        singleValue: 2.0
+        singleValue: 0.0
       - meterId:
           name: sw_go_possible_leaked_context_counter
           tags:
@@ -116,5 +131,5 @@ meterItems:
           name: sw_go_created_tracing_context_counter
           tags:
             - {name: created_by, value: sampler}
-        singleValue: 4.0
+        singleValue: 6.0
 logItems: [ ]

Reply via email to