@@ -39,9 +39,7 @@ internal class DatadogCoreProxy: DatadogCoreProtocol {
3939 )
4040 }
4141
42- func set( baggage: @escaping ( ) -> FeatureBaggage ? , forKey key: String ) {
43- core. set ( baggage: baggage, forKey: key)
44- }
42+ func set< Context> ( context: @escaping ( ) -> Context ? ) where Context : DatadogInternal . AdditionalContext { }
4543
4644 func send( message: FeatureMessage , else fallback: @escaping ( ) -> Void ) {
4745 core. send ( message: message, else: fallback)
@@ -79,16 +77,14 @@ private struct FeatureScopeProxy: FeatureScope {
7977 proxy. send ( message: message, else: fallback)
8078 }
8179
82- func set( baggage: @escaping ( ) -> FeatureBaggage ? , forKey key: String ) {
83- proxy. set ( baggage: baggage, forKey: key)
84- }
80+ func set< Context> ( context: @escaping ( ) -> Context ? ) where Context : DatadogInternal . AdditionalContext { }
8581
8682 func set( anonymousId: String ? ) {
87- proxy. set ( anonymousId: anonymousId)
83+ proxy. set ( anonymousId: anonymousId)
8884 }
8985}
9086
91- private class FeatureScopeInterceptor {
87+ private final class FeatureScopeInterceptor : @ unchecked Sendable {
9288 struct InterceptingWriter : Writer {
9389 static let jsonEncoder = JSONEncoder . dd. default ( )
9490
@@ -127,7 +123,7 @@ private class FeatureScopeInterceptor {
127123 return events
128124 }
129125
130- func waitAndDeleteEvents( ) -> Void {
126+ func waitAndDeleteEvents( ) {
131127 _ = group. wait ( timeout: . distantFuture)
132128 events = [ ]
133129 }
@@ -139,7 +135,7 @@ extension DatadogCoreProxy {
139135 /// - name: The Feature to retrieve events from
140136 /// - type: The type of events to filter out
141137 /// - Returns: A list of events.
142- func waitAndReturnEvents< T> ( ofFeature name: String , ofType type: T . Type , timeout: DispatchTime = . distantFuture) -> [ T ] where T: Encodable {
138+ public func waitAndReturnEvents< T> ( ofFeature name: String , ofType type: T . Type , timeout: DispatchTime = . distantFuture) -> [ T ] where T: Encodable {
143139 guard let interceptor = self . featureScopeInterceptors [ name] else {
144140 return [ ] // feature scope was not requested, so there's no interception
145141 }
@@ -150,11 +146,10 @@ extension DatadogCoreProxy {
150146 ///
151147 /// - Parameter feature: The Feature to retrieve events from
152148 /// - Returns: A list of serialized events.
153- func waitAndReturnEventsData( ofFeature name: String , timeout: DispatchTime = . distantFuture) -> [ String ] {
149+ public func waitAndReturnEventsData( ofFeature name: String , timeout: DispatchTime = . distantFuture) -> [ String ] {
154150 guard let interceptor = self . featureScopeInterceptors [ name] else {
155151 return [ ] // feature scope was not requested, so there's no interception
156152 }
157-
158153 return interceptor
159154 . waitAndReturnEvents ( timeout: timeout)
160155 . compactMap { $0. data. base64EncodedString ( ) }
0 commit comments