Skip to content

Commit 7a9dea8

Browse files
authored
Fix wrong tracing context switch when trace ignore plugin activated (#237)
1 parent afa75a3 commit 7a9dea8

File tree

4 files changed

+31
-15
lines changed

4 files changed

+31
-15
lines changed

.github/workflows/windows-plugin-test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ jobs:
8787
8888
sudo service docker start
8989
90-
curl -SL https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
90+
curl -SL https://github.com/docker/compose/releases/download/v2.24.5/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
9191
sudo chmod +x /usr/local/bin/docker-compose
9292
docker-compose --version
9393
- name: WSL – Install Go 1.19

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Release Notes.
1818
#### Bug Fixes
1919

2020
* Fix plugin interceptors bypassed on Windows.
21+
* Fix wrong tracing context switch when trace ignore plugin activated.
2122

2223
#### Issues and PR
2324
- All issues are [here](https://github.com/apache/skywalking/milestone/238?closed=1)

plugins/core/tracing.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -266,14 +266,6 @@ func (s *ContextSnapshot) IsValid() bool {
266266
}
267267

268268
func (t *Tracer) createNoop(operationName string) (*TracingContext, TracingSpan, bool) {
269-
if !t.InitSuccess() || t.Reporter.ConnectionStatus() == reporter.ConnectionStatusDisconnect {
270-
GetSo11y(t).MeasureTracingContextCreation(false, true)
271-
return nil, newNoopSpan(t), true
272-
}
273-
if tracerIgnore(operationName, t.ignoreSuffix, t.traceIgnorePath) {
274-
GetSo11y(t).MeasureTracingContextCreation(false, true)
275-
return nil, newNoopSpan(t), true
276-
}
277269
ctx := getTracingContext()
278270
if ctx != nil {
279271
span := ctx.ActiveSpan()
@@ -284,6 +276,14 @@ func (t *Tracer) createNoop(operationName string) (*TracingContext, TracingSpan,
284276
}
285277
return ctx, span, ok
286278
}
279+
if !t.InitSuccess() || t.Reporter.ConnectionStatus() == reporter.ConnectionStatusDisconnect {
280+
GetSo11y(t).MeasureTracingContextCreation(false, true)
281+
return nil, newNoopSpan(t), true
282+
}
283+
if tracerIgnore(operationName, t.ignoreSuffix, t.traceIgnorePath) {
284+
GetSo11y(t).MeasureTracingContextCreation(false, true)
285+
return nil, newNoopSpan(t), true
286+
}
287287
ctx = NewTracingContext()
288288
return ctx, nil, false
289289
}

test/plugins/scenarios/so11y/config/excepted.yml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,21 @@ segmentItems:
5656
- { key: http.method, value: GET }
5757
- { key: url, value: 'localhost:8080/propagated' }
5858
- { key: status_code, value: '200' }
59+
- operationName: GET:/ignored.html
60+
parentSpanId: 0
61+
spanId: 2
62+
spanLayer: Http
63+
startTime: nq 0
64+
endTime: nq 0
65+
componentId: 5005
66+
isError: false
67+
spanType: Exit
68+
peer: localhost:8080
69+
skipAnalysis: false
70+
tags:
71+
- { key: http.method, value: GET }
72+
- { key: url, value: 'localhost:8080/ignored.html' }
73+
- { key: status_code, value: '200' }
5974
- operationName: GET:/so11y
6075
parentSpanId: -1
6176
spanId: 0
@@ -81,13 +96,13 @@ meterItems:
8196
- {name: source, value: ignore}
8297
singleValue: 0.0
8398
- meterId:
84-
name: sw_go_finished_tracing_context_counter
99+
name: sw_go_finished_ignored_context_counter
85100
tags: []
86-
singleValue: 4.0
101+
singleValue: 0.0
87102
- meterId:
88-
name: sw_go_finished_ignored_context_counter
103+
name: sw_go_finished_tracing_context_counter
89104
tags: []
90-
singleValue: 2.0
105+
singleValue: 6.0
91106
- meterId:
92107
name: sw_go_tracing_context_performance
93108
tags: []
@@ -106,7 +121,7 @@ meterItems:
106121
name: sw_go_created_ignored_context_counter
107122
tags:
108123
- {name: created_by, value: sampler}
109-
singleValue: 2.0
124+
singleValue: 0.0
110125
- meterId:
111126
name: sw_go_possible_leaked_context_counter
112127
tags:
@@ -116,5 +131,5 @@ meterItems:
116131
name: sw_go_created_tracing_context_counter
117132
tags:
118133
- {name: created_by, value: sampler}
119-
singleValue: 4.0
134+
singleValue: 6.0
120135
logItems: [ ]

0 commit comments

Comments
 (0)