@@ -16,10 +16,6 @@ private let OS_ACTIVITY_CURRENT = unsafeBitCast(dlsym(UnsafeMutableRawPointer(bi
16
16
17
17
class ActivityContextManager: ContextManager {
18
18
static let instance = ActivityContextManager ( )
19
- #if swift(>=5.5.2)
20
- @available ( macOS 10 . 15 , iOS 13 . 0 , tvOS 13 . 0 , * )
21
- static let taskLocalContextManager = TaskLocalContextManager . instance
22
- #endif
23
19
24
20
let rlock = NSRecursiveLock ( )
25
21
@@ -28,8 +24,6 @@ class ActivityContextManager: ContextManager {
28
24
self . scope = scope
29
25
}
30
26
31
- deinit { }
32
-
33
27
var scope : os_activity_scope_state_s
34
28
}
35
29
@@ -38,13 +32,6 @@ class ActivityContextManager: ContextManager {
38
32
var contextMap = [ os_activity_id_t: [ String: AnyObject] ] ( )
39
33
40
34
func getCurrentContextValue( forKey key: OpenTelemetryContextKeys ) -> AnyObject ? {
41
- #if swift(>=5.5.2)
42
- if #available( macOS 10 . 15 , iOS 13 . 0 , tvOS 13 . 0 , * ) {
43
- if let contextValue = ActivityContextManager . taskLocalContextManager. getCurrentContextValue ( forKey: key) {
44
- return contextValue
45
- }
46
- }
47
- #endif
48
35
var parentIdent : os_activity_id_t = 0
49
36
let activityIdent = os_activity_get_identifier ( OS_ACTIVITY_CURRENT, & parentIdent)
50
37
var contextValue : AnyObject ?
@@ -59,20 +46,6 @@ class ActivityContextManager: ContextManager {
59
46
}
60
47
61
48
func setCurrentContextValue( forKey key: OpenTelemetryContextKeys , value: AnyObject ) {
62
- #if swift(>=5.5.2)
63
- if #available( macOS 10 . 15 , iOS 13 . 0 , tvOS 13 . 0 , * ) {
64
- var insideTask = false
65
- withUnsafeCurrentTask { task in
66
- if task != nil {
67
- insideTask = true
68
- }
69
- }
70
- if insideTask {
71
- ActivityContextManager . taskLocalContextManager. setCurrentContextValue ( forKey: key, value: value)
72
- return
73
- }
74
- }
75
- #endif
76
49
var parentIdent : os_activity_id_t = 0
77
50
var activityIdent = os_activity_get_identifier ( OS_ACTIVITY_CURRENT, & parentIdent)
78
51
rlock. lock ( )
@@ -96,20 +69,6 @@ class ActivityContextManager: ContextManager {
96
69
}
97
70
98
71
func removeContextValue( forKey key: OpenTelemetryContextKeys , value: AnyObject ) {
99
- #if swift(>=5.5.2)
100
- if #available( macOS 10 . 15 , iOS 13 . 0 , tvOS 13 . 0 , * ) {
101
- var insideTask = false
102
- withUnsafeCurrentTask { task in
103
- if task != nil {
104
- insideTask = true
105
- }
106
- }
107
- if insideTask {
108
- ActivityContextManager . taskLocalContextManager. removeContextValue ( forKey: key, value: value)
109
- return
110
- }
111
- }
112
- #endif
113
72
if let scope = objectScope. object ( forKey: value) {
114
73
var scope = scope. scope
115
74
os_activity_scope_leave ( & scope)
0 commit comments