Contents

URLSessionTaskTransactionMetrics

An object that encapsualtes the performance metrics collected by the URL Loading System during the execution of a session task.

Declaration

class URLSessionTaskTransactionMetrics

Overview

Each URLSessionTaskTransactionMetrics 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 fetchStartDate and ending with responseEndDate, as well as other characteristics like networkProtocolName and resourceFetchType.

Understanding temporal metrics

The figure below shows the sequence of events for a URL session task, which correspond to the temporal metrics captured by URLSessionTaskTransactionMetrics.

[Image]

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 domainLookupEndDate property is nil, along with all metrics for aspects that occurred afterwards.

Measuring tasks using iCloud Private Relay

iCloud Private Relay can change the timing and sequence of events for your tasks by sending requests through a set of privacy proxies. All tasks that use iCloud Private Relay set the isProxyConnection property in their transaction metrics. In this case, the remoteAddress property contains the address of the proxy, and not the origin server.

Tasks to different hosts can reuse the same transport connection, just like how tasks can already share a connection when using HTTP/2. In these cases, a proxied task may not report any secureConnectionStartDate or secureConnectionEndDate.

Topics

Accessing request and response

Accessing temporal metrics

Accessing data transfer metrics

Accessing transaction characteristics

Creating transaction metrics

See Also

Accessing task metrics