-
-
Couldn't load subscription status.
- Fork 674
Add stats of client and pool to be accessible through agent #4157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
2661544
28ec198
df86d9b
4370e3d
2947cba
39c7617
651eb86
0c22ba5
8855ecb
ab942e4
f2452c4
15bc63b
5a93529
435acc8
373736e
52e7d94
7ac13ff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| 'use strict' | ||
|
||
|
|
||
| const { kConnected, kPending, kRunning, kSize } = require('../core/symbols') | ||
| const kClient = Symbol('client') | ||
|
|
||
| class ClientStats { | ||
| constructor (client) { | ||
| this[kClient] = client | ||
| } | ||
|
|
||
| get connected () { | ||
| return this[kClient][kConnected] | ||
| } | ||
|
|
||
| get pending () { | ||
| return this[kClient][kPending] | ||
| } | ||
|
|
||
| get running () { | ||
| return this[kClient][kRunning] | ||
| } | ||
|
|
||
| get size () { | ||
| return this[kClient][kSize] | ||
| } | ||
| } | ||
|
|
||
| module.exports = ClientStats | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ const util = require('../core/util.js') | |
| const { channels } = require('../core/diagnostics.js') | ||
| const Request = require('../core/request.js') | ||
| const DispatcherBase = require('./dispatcher-base') | ||
| const ClientStats = require('./client-stats') | ||
| const { | ||
| InvalidArgumentError, | ||
| InformationalError, | ||
|
|
@@ -51,7 +52,8 @@ const { | |
| kOnError, | ||
| kHTTPContext, | ||
| kMaxConcurrentStreams, | ||
| kResume | ||
| kResume, | ||
| kStats | ||
| } = require('../core/symbols.js') | ||
| const connectH1 = require('./client-h1.js') | ||
| const connectH2 = require('./client-h2.js') | ||
|
|
@@ -249,6 +251,8 @@ class Client extends DispatcherBase { | |
|
|
||
| this[kResume] = (sync) => resume(this, sync) | ||
| this[kOnError] = (err) => onError(this, err) | ||
|
|
||
| this[kStats] = new ClientStats(this) | ||
|
||
| } | ||
|
|
||
| get pipelining () { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is used now by Pool and Client. Hence it should be shared in my opinion.