NNovaNetworkClientSwift networkingGitHub ↗

Beginner · 8 min

See what the client did

Record requests, read the retry waterfall, export a HAR for the bug report.

You’ll buildA live request list, a retry timeline, and a HAR file you can attach to a ticket.
1
Step 1

Install the recorder

Diagnostics consumes the telemetry the client already emits, so nothing about the client changes.

Seewhattheclientdid.swift
import NovaNetworkDiagnostics

let recorder = DiagnosticsRecorder()
var configuration = NetworkClientConfiguration()
configuration.telemetryHooks = recorder.hooks
let client = NetworkClient(configuration: configuration)
recorder.startConsuming(client.events())
2
Step 2

Read one request, not three

The client reports a start and an end per attempt and announces a retry only after the attempt failed. The recorder stitches them into the request a person actually made.

Seewhattheclientdid.swift
GET /flaky — 200 in 598 ms
  █████████████ Attempt 1
  ············ Backoff 185 ms
               ██████████████████████████ Attempt 2
               ·························· Backoff 399 ms
                                         █ Attempt 3
3
Step 3

Trust the summary

A transport that returns a 500 completed the exchange — nothing threw. failureRate counts HTTP errors anyway, because 0% failed beside a list of 500s would be worse than no summary.

Seewhattheclientdid.swift
let summary = await recorder.summary()
print(summary.shortDescription)
// 4 requests · 50% failed · 25% coalesced · 66% cache hits
4
Step 4

Export it

HAR 1.2 opens in any browser's network inspector, so a support artifact needs no new viewer.

Seewhattheclientdid.swift
let har = try await recorder.exportHAR()
try har.write(to: url)
✓

Tutorial complete

A live request list, a retry timeline, and a HAR file you can attach to a ticket.