Skip to content

Automatic URLSessionTaskMetrics performance tracking? #3150

Closed Answered by philipphofmann
WFT asked this question in Q&A
Discussion options

You must be logged in to vote

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 NSURLSessionTask setState and re…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@WFT
Comment options

@philipphofmann
Comment options

@philipphofmann
Comment options

@WFT
Comment options

Answer selected by WFT
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants