Skip to content
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

Websocket connection stats and request stats #3106

Closed
rajanigk opened this issue Nov 14, 2018 · 12 comments
Closed

Websocket connection stats and request stats #3106

rajanigk opened this issue Nov 14, 2018 · 12 comments
Assignees

Comments

@rajanigk
Copy link

Hi,
The connecton and requests stats are not provided for websockets. The default method of obtaining the request and connection stats as documented in

https://www.eclipse.org/jetty/documentation/9.4.x/statistics-handler.html

does not provide the stats for the websocket connections. even though the connectionTotal, connectionMax do get updated, the connections stats do not give the the active connections. The reason being for every websocket connection request a HTTP connection is opened fiest and that updates the connection stats, but that HTTP connection gets closed when the upgrade request is passed on that connection, which decrements the active connection count in the connection stats. I see even the requestsStats do get decremented. So the connection and requests stats for websocket connection are not correct.
I do see
http://download.eclipse.org/jetty/9.4.3.v20170317/apidocs/index.html?org/eclipse/jetty/websocket/common/io/AbstractWebSocketConnection.Stats.html

exaplanation, and this class has the following three stats

getFillableErrorCount()
getFillInterestedCount()
getOnFillableCount()

I am not sure what these stats signify, there is no bean associated with these stats, so this statistics can not be obtained through jmx.

Would like to know if there is a plan to get the websocket stats? If so in which release? Or is there any other way i can get the stats?

Regards,
Rajani

@gregw
Copy link
Contributor

gregw commented Nov 14, 2018

We are doing a significant refactor of websocket for jetty-10, so @lachlan-roberts can you make sure there are good stats in that. We will also look to see what we can better expose in 9.4.x

@gregw
Copy link
Contributor

gregw commented Nov 14, 2018

The fillable stats are very low level stats and not really meaningful for a user. They should be removed and replaced by message and byte counts.

@joakime
Copy link
Contributor

joakime commented Nov 14, 2018

The fillable stats were historical to help diagnose a long ago issue with the websocket implementation.
They should have been removed a while ago.

@gregw
Copy link
Contributor

gregw commented Nov 14, 2018

Chatted to @lachlan-roberts about this. WebSocketConnection can be modified to implement the byte and message counts abstracted in the Connection interface and then they will be available via the normal ConnectionStatistics mechanism, although they will not be separable from HTTP and are only updated on close.

In addition, it should possible to use the anonymous extension feature of the ExtensionStack class to create an @statistics extension, that can be transparently added to websocket connection to gather live stats about frames, bytes and messages, to be aggregated (somewhere?) and made available via JMX.

These changes should be moderately portable from 9.4.x and 10.0.x

@rajanigk
Copy link
Author

rajanigk commented Nov 14, 2018 via email

@gregw
Copy link
Contributor

gregw commented Nov 14, 2018

@rajanigk we are working on them for jetty-10 and there are probably a few weeks away. Once implemented there, we can consider a back port to jetty-9.4.x, so that is probably a month away at least.

@rajanigk
Copy link
Author

rajanigk commented Nov 15, 2018 via email

@rajanigk
Copy link
Author

is there any update on this issue?

@joakime
Copy link
Contributor

joakime commented Feb 17, 2019

There's no releases of jetty-10.0.x that has these stats.
Once the stats and release exist we hope to update this issue.

lachlan-roberts added a commit to lachlan-roberts/jetty.project that referenced this issue Feb 25, 2019
Signed-off-by: lachan-roberts <lachlan@webtide.com>
lachlan-roberts added a commit to lachlan-roberts/jetty.project that referenced this issue Feb 25, 2019
Signed-off-by: lachan-roberts <lachlan@webtide.com>
lachlan-roberts added a commit to lachlan-roberts/jetty.project that referenced this issue Feb 26, 2019
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
lachlan-roberts added a commit to lachlan-roberts/jetty.project that referenced this issue Feb 27, 2019
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
lachlan-roberts added a commit to lachlan-roberts/jetty.project that referenced this issue Feb 28, 2019
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
lachlan-roberts added a commit to lachlan-roberts/jetty.project that referenced this issue Mar 1, 2019
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
lachlan-roberts added a commit to lachlan-roberts/jetty.project that referenced this issue Mar 1, 2019
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
lachlan-roberts added a commit to lachlan-roberts/jetty.project that referenced this issue Mar 1, 2019
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
lachlan-roberts added a commit to lachlan-roberts/jetty.project that referenced this issue Mar 1, 2019
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
lachlan-roberts added a commit to lachlan-roberts/jetty.project that referenced this issue Mar 5, 2019
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
lachlan-roberts added a commit to lachlan-roberts/jetty.project that referenced this issue Mar 5, 2019
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
lachlan-roberts added a commit to lachlan-roberts/jetty.project that referenced this issue Mar 5, 2019
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
gregw added a commit that referenced this issue Mar 6, 2019
…cketConnectionStats

Issue #3106 - implement WebSocketConnection stats
lachlan-roberts added a commit to lachlan-roberts/jetty.project that referenced this issue Mar 26, 2019
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
lachlan-roberts added a commit to lachlan-roberts/jetty.project that referenced this issue Mar 28, 2019
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
gregw pushed a commit that referenced this issue Mar 28, 2019
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
gregw pushed a commit that referenced this issue Mar 28, 2019
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
@lachlan-roberts
Copy link
Contributor

@rajanigk WebSocket Connection stats are now present in both the 9.4.x and 10.0.x branches if you want to try it out.

these stats are for messages and bytes in/out and are available through the Connector statistics mechanism described at
https://www.eclipse.org/jetty/documentation/9.4.x/statistics-handler.html#connector-statistics

lachlan-roberts added a commit that referenced this issue Sep 13, 2019
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
@sagarikat-26
Copy link

Hi @lachlan-roberts is the websocket connection stats now available with 9.4.31v .As i was trying to get the numberof active websocket connections for the server still don't see any difference

@lachlan-roberts
Copy link
Contributor

@sagarika-hp yes these stats are available in 9.4.31 by using the ConnectionStatistics class.

This is also tested in the jetty code in WebSocketStatsTest so you could look to that for an embedded example how this is to be used, and it seems to be working. Can you open a new issue for this and detail your setup and show how you're trying to get these stats.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants