Skip to content

Commit 73d6eb7

Browse files
author
Ignacio Bonafonte
committed
Fix task local stack was not being handled correctly, it could set external values
1 parent b7cfe3b commit 73d6eb7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/OpenTelemetryApi/Context/ActivityContextManager.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,15 @@ class ActivityContextManager: ContextManager {
139139
if #available(macOS 12.0, iOS 15.0, tvOS 15.0, *) {
140140
// If there is a parent activity, set its content as the task local
141141
ActivityContextManager.taskLocalContextManager.removeContextValue(forKey: key, value: value)
142-
if let currentContext = self.getCurrentContextValue(forKey: key) {
142+
if let currentContext = ActivityContextManager.taskLocalContextManager.getCurrentContextValue(forKey: key) {
143143
ActivityContextManager.taskLocalContextManager.setCurrentContextValue(forKey: key, value: currentContext)
144144
}
145145
}
146146
#else
147147
// If there is a parent activity, set its content as the task local
148148
if #available(macOS 10.15, iOS 13.0, tvOS 13.0, *) {
149149
ActivityContextManager.taskLocalContextManager.removeContextValue(forKey: key, value: value)
150-
if let currentContext = self.getCurrentContextValue(forKey: key) {
150+
if let currentContext = ActivityContextManager.taskLocalContextManager.getCurrentContextValue(forKey: key) {
151151
ActivityContextManager.taskLocalContextManager.setCurrentContextValue(forKey: key, value: currentContext)
152152
}
153153
}

0 commit comments

Comments
 (0)