<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.12.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 3.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/URLSessionTaskMetrics",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSURLSessionTaskMetrics"
  },
  "title" : "URLSessionTaskMetrics"
}
-->

# URLSessionTaskMetrics

An object encapsulating the metrics for a session task.

```
class URLSessionTaskMetrics
```

## Overview

Each [`URLSessionTaskMetrics`](/documentation/Foundation/URLSessionTaskMetrics) object contains the [`taskInterval`](/documentation/Foundation/URLSessionTaskMetrics/taskInterval) and [`redirectCount`](/documentation/Foundation/URLSessionTaskMetrics/redirectCount), as well as metrics for each request-and-response transaction made during the execution of the task.

## Topics

### Creating task metrics

[`init()`](/documentation/Foundation/URLSessionTaskMetrics/init())

Creates a task metrics instance.

### Accessing task metrics

[`transactionMetrics`](/documentation/Foundation/URLSessionTaskMetrics/transactionMetrics)

An array of metrics for each individual request-response transaction made during the execution of the task.

[`URLSessionTaskTransactionMetrics`](/documentation/Foundation/URLSessionTaskTransactionMetrics)

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

[`taskInterval`](/documentation/Foundation/URLSessionTaskMetrics/taskInterval)

The time interval between when a task is instantiated and when the task is completed.

[`redirectCount`](/documentation/Foundation/URLSessionTaskMetrics/redirectCount)

The number of redirects that occurred during the execution of the task.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)