swift-server / swift-server/async-http-client

AsyncHTTPClient should export metrics

Open
#342 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/enhancement
Dominant language
Swift
Stars
1.1k
Forks
156
PR merge metrics
No merged PRs in 30d

Description

Developers want to monitor metrics of outgoing http requests to identify potential causes of issues with dashboards.

While it is possible to generate some metrics by implementing a custom HTTPClientResponseDelegate today, this is quite a burden. Further there are some metrics AsyncHTTPClient users don't have access to. For example:

  • Number of active http/1.1 requests to a host
  • Number of requests in the queue to a host

The metrics should be exported to SwiftMetrics directly or with a delegate protocol call comparable to URLSession:task:didFinishCollectingMetrics: exporting NSURLSessionTaskMetrics. If the latter approach is chosen, there should also be a callback/delegate to observe the connection pool size and requests queued per ConnectionPool.Key.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Begin with HTTPClientResponseDelegate and ConnectionPool.Key, the existing extension points named in the issue. Compare direct SwiftMetrics integration with a delegate callback modeled on NSURLSessionTaskMetrics. Done means users can observe outgoing-request metrics, including active HTTP/1.1 requests and per-host queued requests, plus connection-pool size and queue metrics if the delegate approach is chosen.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
networking, observability
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.