{
  "type": "module",
  "source": "doc/api/api-poolstats.md",
  "modules": [
    {
      "textRaw": "PoolStats",
      "name": "poolstats",
      "introduced_in": "v4.15.0",
      "type": "module",
      "stability": 2,
      "stabilityText": "Stable",
      "desc": "<p><code>PoolStats</code> exposes a read-only snapshot of the aggregate connection and request\ncounters for a <a href=\"Pool.html#class-pool\"><code>Pool</code></a> or <a href=\"BalancedPool.html#class-balancedpool\"><code>BalancedPool</code></a>. An instance is created lazily\neach time the <code>pool.stats</code> getter is accessed, so the values reflect the state of\nthe pool at the moment of access.</p>\n<p><code>PoolStats</code> is not constructed directly in normal use; obtain an instance from\nthe <code>stats</code> property of a pool:</p>\n<pre><code class=\"language-mjs\">import { Pool } from 'undici'\n\nconst pool = new Pool('http://localhost:3000')\nconst { stats } = pool\n\nconsole.log(stats.connected, stats.running, stats.size)\n</code></pre>",
      "classes": [
        {
          "textRaw": "Class: `PoolStats`",
          "name": "PoolStats",
          "type": "class",
          "meta": {
            "added": [
              "v4.15.0"
            ],
            "changes": [
              {
                "version": "v7.9.0",
                "pr-url": "https://github.com/nodejs/undici/pull/4157",
                "description": "Pool and client stats are exposed through `Agent`."
              }
            ]
          },
          "desc": "<p>Each property is a plain number computed from the pool's internal state when the\ninstance is created. The instance is a snapshot; read <code>pool.stats</code> again to\nobserve later changes.</p>",
          "signatures": [
            {
              "textRaw": "`new PoolStats(pool)`",
              "name": "PoolStats",
              "type": "ctor",
              "meta": {
                "added": [
                  "v4.15.0"
                ],
                "changes": [
                  {
                    "version": "v7.9.0",
                    "pr-url": "https://github.com/nodejs/undici/pull/4157",
                    "description": "Pool and client stats are exposed through `Agent`."
                  }
                ]
              },
              "params": [
                {
                  "textRaw": "`pool` {Pool|BalancedPool} The pool to read counters from.",
                  "name": "pool",
                  "type": "Pool|BalancedPool",
                  "desc": "The pool to read counters from."
                }
              ],
              "desc": "<p>Creates a new <code>PoolStats</code> instance from the current state of <code>pool</code>. Prefer the\n<code>pool.stats</code> getter, which returns a fresh <code>PoolStats</code> on each access.</p>"
            }
          ],
          "properties": [
            {
              "textRaw": "Type: {number}",
              "name": "connected",
              "type": "number",
              "meta": {
                "added": [
                  "v4.15.0"
                ],
                "changes": [
                  {
                    "version": "v7.9.0",
                    "pr-url": "https://github.com/nodejs/undici/pull/4157",
                    "description": "Pool and client stats are exposed through `Agent`."
                  }
                ]
              },
              "desc": "<p>Number of open socket connections in this pool.</p>"
            },
            {
              "textRaw": "Type: {number}",
              "name": "free",
              "type": "number",
              "meta": {
                "added": [
                  "v4.15.0"
                ],
                "changes": [
                  {
                    "version": "v7.9.0",
                    "pr-url": "https://github.com/nodejs/undici/pull/4157",
                    "description": "Pool and client stats are exposed through `Agent`."
                  }
                ]
              },
              "desc": "<p>Number of open socket connections in this pool that do not have an active\nrequest.</p>"
            },
            {
              "textRaw": "Type: {number}",
              "name": "pending",
              "type": "number",
              "meta": {
                "added": [
                  "v4.15.0"
                ],
                "changes": [
                  {
                    "version": "v7.9.0",
                    "pr-url": "https://github.com/nodejs/undici/pull/4157",
                    "description": "Pool and client stats are exposed through `Agent`."
                  }
                ]
              },
              "desc": "<p>Number of pending requests across all clients in this pool.</p>"
            },
            {
              "textRaw": "Type: {number}",
              "name": "queued",
              "type": "number",
              "meta": {
                "added": [
                  "v4.15.0"
                ],
                "changes": [
                  {
                    "version": "v7.9.0",
                    "pr-url": "https://github.com/nodejs/undici/pull/4157",
                    "description": "Pool and client stats are exposed through `Agent`."
                  }
                ]
              },
              "desc": "<p>Number of queued requests across all clients in this pool.</p>"
            },
            {
              "textRaw": "Type: {number}",
              "name": "running",
              "type": "number",
              "meta": {
                "added": [
                  "v4.15.0"
                ],
                "changes": [
                  {
                    "version": "v7.9.0",
                    "pr-url": "https://github.com/nodejs/undici/pull/4157",
                    "description": "Pool and client stats are exposed through `Agent`."
                  }
                ]
              },
              "desc": "<p>Number of currently active requests across all clients in this pool.</p>"
            },
            {
              "textRaw": "Type: {number}",
              "name": "size",
              "type": "number",
              "meta": {
                "added": [
                  "v4.15.0"
                ],
                "changes": [
                  {
                    "version": "v7.9.0",
                    "pr-url": "https://github.com/nodejs/undici/pull/4157",
                    "description": "Pool and client stats are exposed through `Agent`."
                  }
                ]
              },
              "desc": "<p>Number of active, pending, or queued requests across all clients in this pool.</p>"
            }
          ]
        }
      ]
    }
  ]
}