Skip to content

Commit 139ab94

Browse files
nhart12bryce-b
andauthored
Expose URLSessionInstrumentation configuration as public (#820)
* Expose URLSessionInstrumentation configuration as public * Using FIFO queue on getters of the configuration --------- Co-authored-by: Bryce Buchanan <[email protected]>
1 parent b4bcdf1 commit 139ab94

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Sources/Instrumentation/URLSession/URLSessionInstrumentation.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,15 @@ private var idKey: Void?
2929
public class URLSessionInstrumentation {
3030
private var requestMap = [String: NetworkRequestState]()
3131

32-
var configuration: URLSessionInstrumentationConfiguration
32+
private var _configuration: URLSessionInstrumentationConfiguration
33+
public var configuration: URLSessionInstrumentationConfiguration {
34+
get { configurationQueue.sync { _configuration } }
35+
}
3336

3437
private let queue = DispatchQueue(
3538
label: "io.opentelemetry.ddnetworkinstrumentation")
39+
private let configurationQueue = DispatchQueue(
40+
label: "io.opentelemetry.configuration")
3641

3742
static var instrumentedKey = "io.opentelemetry.instrumentedCall"
3843

@@ -52,7 +57,7 @@ public class URLSessionInstrumentation {
5257
}
5358

5459
public init(configuration: URLSessionInstrumentationConfiguration) {
55-
self.configuration = configuration
60+
self._configuration = configuration
5661
injectInNSURLClasses()
5762
}
5863

0 commit comments

Comments
 (0)