Skip to content

Commit ffdf949

Browse files
authored
Remove AFNetworking specific checks in URLSession instrumentation (#979)
* removed AFURLSessionManager instrumentation * bumped URLSessionInstrumentation to 1.0.0 due to breaking change
1 parent 75da90c commit ffdf949

2 files changed

Lines changed: 3 additions & 14 deletions

File tree

Sources/Instrumentation/URLSession/URLSessionInstrumentation.swift

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class URLSessionInstrumentation {
3131

3232
private var _configuration: URLSessionInstrumentationConfiguration
3333
public var configuration: URLSessionInstrumentationConfiguration {
34-
get{
34+
get {
3535
configurationQueue.sync { _configuration }
3636
}
3737
set {
@@ -452,17 +452,6 @@ public class URLSessionInstrumentation {
452452
methodsToSwizzle.append(method)
453453
}
454454

455-
if NSClassFromString("AFURLSessionManager") != nil {
456-
let classes = InstrumentationUtils.objc_getSafeClassList(
457-
ignoredPrefixes: configuration.ignoredClassPrefixes
458-
)
459-
classes.forEach {
460-
if let method = class_getInstanceMethod($0, NSSelectorFromString("af_resume")) {
461-
methodsToSwizzle.append(method)
462-
}
463-
}
464-
}
465-
466455
methodsToSwizzle.forEach {
467456
let theMethod = $0
468457

Sources/Instrumentation/URLSession/URLSessionInstrumentationConfiguration.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public struct URLSessionInstrumentationConfiguration {
4040
self.delegateClassesToInstrument = delegateClassesToInstrument
4141
self.baggageProvider = baggageProvider
4242
self.tracer = tracer ??
43-
OpenTelemetry.instance.tracerProvider.get(instrumentationName: "NSURLSession", instrumentationVersion: "0.0.1")
43+
OpenTelemetry.instance.tracerProvider.get(instrumentationName: "NSURLSession", instrumentationVersion: "1.0.0")
4444
self.ignoredClassPrefixes = ignoredClassPrefixes
4545
}
4646

@@ -92,7 +92,7 @@ public struct URLSessionInstrumentationConfiguration {
9292
/// Note: The injected baggage depends on the propagator in use (e.g., W3C or custom).
9393
/// Returns: A `Baggage` instance or `nil` if no baggage is needed.
9494
public let baggageProvider: ((inout URLRequest, Span?) -> (Baggage)?)?
95-
95+
9696
/// The Array of Prefixes you can avoid in swizzle process
9797
public let ignoredClassPrefixes: [String]?
9898
}

0 commit comments

Comments
 (0)