Skip to content

Commit 8ecc908

Browse files
committed
docs: add metrics changes to NEWS.md
1 parent 2943f4a commit 8ecc908

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

NEWS.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,37 @@ The connection pool has been completely redesigned:
9191

9292
- fix: validate connection state on pool checkout for HTTP/2 and HTTP/3. On FreeBSD + OTP 28, pooled connections could be in `closed` state when checked out due to SSL timing differences, causing `{error, invalid_state}` errors. Now connections are verified to be in `connected` state after checkout.
9393

94+
### Metrics
95+
96+
Native metrics system with pluggable backends, replacing the external `metrics` library dependency:
97+
98+
- **Pluggable backends** - `hackney_metrics_backend` behaviour for custom implementations
99+
- **Dummy backend** (default) - Zero-overhead no-op backend when metrics not needed
100+
- **Prometheus backend** (opt-in) - Full Prometheus integration when enabled
101+
- **Correct metric types** - Pool counts now use gauges instead of histograms (#560)
102+
103+
#### Prometheus Metrics
104+
105+
When enabled, the following metrics are exported:
106+
107+
| Metric | Type | Labels | Description |
108+
|--------|------|--------|-------------|
109+
| `hackney_requests_total` | Counter | host | Total requests started |
110+
| `hackney_requests_active` | Gauge | host | Currently active requests |
111+
| `hackney_requests_finished_total` | Counter | host | Completed requests |
112+
| `hackney_request_duration_seconds` | Histogram | host | Request duration in seconds |
113+
| `hackney_pool_free_count` | Gauge | pool | Available connections in pool |
114+
| `hackney_pool_in_use_count` | Gauge | pool | Connections currently in use |
115+
| `hackney_pool_checkouts_total` | Counter | pool | Total connection checkouts |
116+
117+
#### Configuration
118+
119+
```erlang
120+
%% Default: dummy backend (zero overhead)
121+
%% To enable Prometheus metrics:
122+
{hackney, [{metrics_backend, prometheus}]}
123+
```
124+
94125
### Requirements
95126

96127
- Erlang/OTP 27+

0 commit comments

Comments
 (0)