An object that encapsualtes the performance metrics collected by the URL Loading System during the execution of a session task.
SDKs
- iOS 10.0+
- macOS 10.12+
- Mac Catalyst 13.0+
- tvOS 10.0+
- watchOS 3.0+
Framework
- Foundation
Declaration
class URLSessionTaskTransactionMetrics : NSObject
Overview
Each URLSession
object consists of a request
and response
property, corresponding to the request and response of the corresponding task. It also contains temporal metrics, starting with fetch
and ending with response
, as well as other characteristics like network
and resource
.
Understanding Temporal Metrics
Figure 1 shows the sequence of events for a URL session task, which correspond to the temporal metrics captured by URLSession
.
Timeline of temporal metrics for a URL session task

For all metrics with a start and end date, if an aspect of the task was not completed, then its corresponding end date metric is nil
. This can happen if name lookup begins, but the operation either times out, fails, or the client cancels the task before the name can be resolved. In this case, the domain
property is nil
, along with all metrics for aspects that occurred afterwards.