PoolStats exposes a read-only snapshot of the aggregate connection and request
counters for a Pool or BalancedPool. An instance is created lazily
each time the pool.stats getter is accessed, so the values reflect the state of
the pool at the moment of access.
PoolStats is not constructed directly in normal use; obtain an instance from
the stats property of a pool:
import { Pool } from 'undici'
const pool = new Pool('http://localhost:3000')
const { stats } = pool
console.log(stats.connected, stats.running, stats.size)Each property is a plain number computed from the pool's internal state when the
instance is created. The instance is a snapshot; read pool.stats again to
observe later changes.
PoolStats Constructor
History
Pool and client stats are exposed through Agent.
new PoolStats(pool): void<Pool>
|
<BalancedPool>Creates a new PoolStats instance from the current state of pool. Prefer the
pool.stats getter, which returns a fresh PoolStats on each access.
poolStats.connected
History
Pool and client stats are exposed through Agent.
<number>Number of open socket connections in this pool.
poolStats.free
History
Pool and client stats are exposed through Agent.
<number>Number of open socket connections in this pool that do not have an active request.
poolStats.pending
History
Pool and client stats are exposed through Agent.
<number>Number of pending requests across all clients in this pool.
poolStats.queued
History
Pool and client stats are exposed through Agent.
<number>Number of queued requests across all clients in this pool.
poolStats.running
History
Pool and client stats are exposed through Agent.
<number>Number of currently active requests across all clients in this pool.
poolStats.size
History
Pool and client stats are exposed through Agent.
<number>Number of active, pending, or queued requests across all clients in this pool.