Automatic URLSessionTaskMetrics performance tracking? #3150
-
Does Sentry support gathering URLSessionTaskTransactionMetrics with its automatic URLSession breadcrumbs/performance tracking? If so, how do I enable it? As far as I can tell the default options don't do it. It would be helpful to track the performance of our API from the perspective of our end users to know at least:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
No, we don't support that feature at the moment. The URLSessionTaskMetrics works by using a delegate with something like the following guard let imgUrl = URL(string: "https://sentry-brand.storage.googleapis.com/sentry-logo-black.png") else {
return
}
let session = URLSession(configuration: URLSessionConfiguration.default)
let dataTask = session.dataTask(with: imgUrl) { (_, _, _) in }
dataTask.delegate = Delegate()
dataTask.resume()
class Delegate: NSObject, URLSessionTaskDelegate {
func urlSession(_ session: URLSession, task: URLSessionTask, didFinishCollecting metrics: URLSessionTaskMetrics) {
}
} Our NetworkTracking integration swizzles the sentry-cocoa/Sources/Sentry/SentryNetworkTrackingIntegration.m Lines 57 to 62 in 4386045 As we have to use a delegate to retrieve the |
Beta Was this translation helpful? Give feedback.
-
I don't like this solution either, it is a little bit dangerous. |
Beta Was this translation helpful? Give feedback.
No, we don't support that feature at the moment. The URLSessionTaskMetrics works by using a delegate with something like the following
Our NetworkTracking integration swizzles the
NSURLSessionTask
setState
andre…