Skip to content

Commit 73a27a6

Browse files
committed
[Tracing] Default tracer to global bootstrapped tracer
The default tracer should be picked up at configuration creation time from the bootstrapped one, so we don't have to manually configure it in the simplest cases. It is possible to disable it by explicitly setting `nil` on the tracing configuration, even if the global tracer was bootstrapped.
1 parent 8430dd4 commit 73a27a6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Sources/AsyncHTTPClient/HTTPClient.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,11 @@ public final class HTTPClient: Sendable {
10951095
package var attributeKeys: AttributeKeys
10961096

10971097
public init() {
1098-
self._tracer = nil
1098+
if #available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) {
1099+
self._tracer = InstrumentationSystem.tracer
1100+
} else {
1101+
self._tracer = nil
1102+
}
10991103
self.attributeKeys = .init()
11001104
}
11011105

0 commit comments

Comments
 (0)