Analyze HTTP Traffic with new HTTP Instrument

Michael Abadi S.
Mac O’Clock
Published in
5 min readOct 31, 2021

--

WWDC21 has been finished last week with over 200 sessions. Most of the time we heard about SwiftUI session or about Async Await. However there are also interesting session about debugging that has been described by Keith Harrison here. In this article I would like to focus on one of the underrated session which is Analyze HTTP Traffic in Instruments. I also write this article in WWDC Notes.

Track hierarchy

First is about track hierarchy. The hierarchy consists of 4 important elements :

  1. HTTP Traffic instruments : Number of active tasks presented
  2. Process : Debuggable process and background tasks daemon
  3. Session : Session will shown one track per URLSession object. During those session there will be an individual task intervals. Besides that, we can configure the session name for more clarity.
  4. Domain
  • Only task that requested in the domain
  • Give more detail about tasks
  • Showing individual transactions
  • Describing the transaction states
let session = URLSession(configuration: .default)
session.sessionDescription = "Main Session" // 👈🏻 Custom session name

Task timing

Task timing is also part of the instruments GUI. We will able to see structural timing from the start of the request until the end of the request

--

--