-
Notifications
You must be signed in to change notification settings - Fork 563
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: expose pool aggregate statistics (#1255)
- Loading branch information
1 parent
8acb03f
commit 4bc0f72
Showing
7 changed files
with
107 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Class: PoolStats | ||
|
||
Aggregate stats for a [Pool](Pool.md) or [BalancedPool](BalancedPool.md). | ||
|
||
## `new PoolStats(pool)` | ||
|
||
Arguments: | ||
|
||
* **pool** `Pool` - Pool or BalancedPool from which to return stats. | ||
|
||
## Instance Properties | ||
|
||
### `PoolStats.connected` | ||
|
||
Number of open socket connections in this pool. | ||
|
||
### `PoolStats.free` | ||
|
||
Number of open socket connections in this pool that do not have an active request. | ||
|
||
### `PoolStats.pending` | ||
|
||
Number of pending requests across all clients in this pool. | ||
|
||
### `PoolStats.queued` | ||
|
||
Number of queued requests across all clients in this pool. | ||
|
||
### `PoolStats.running` | ||
|
||
Number of currently active requests across all clients in this pool. | ||
|
||
### `PoolStats.size` | ||
|
||
Number of active, pending, or queued requests across all clients in this pool. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const { kFree, kConnected, kPending, kQueued, kRunning, kSize } = require('./core/symbols') | ||
const kPool = Symbol('pool') | ||
|
||
class PoolStats { | ||
constructor(pool) { | ||
this[kPool] = pool | ||
} | ||
|
||
get connected() { | ||
return this[kPool][kConnected] | ||
} | ||
|
||
get free() { | ||
return this[kPool][kFree] | ||
} | ||
|
||
get pending() { | ||
return this[kPool][kPending] | ||
} | ||
|
||
get queued() { | ||
return this[kPool][kQueued] | ||
} | ||
|
||
get running() { | ||
return this[kPool][kRunning] | ||
} | ||
|
||
get size() { | ||
return this[kPool][kSize] | ||
} | ||
} | ||
|
||
module.exports = PoolStats |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters