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

Improve ConnectionStatistics to report per-protocol information #4184

Open
sbordet opened this issue Oct 11, 2019 · 10 comments
Open

Improve ConnectionStatistics to report per-protocol information #4184

sbordet opened this issue Oct 11, 2019 · 10 comments
Assignees

Comments

@sbordet
Copy link
Contributor

sbordet commented Oct 11, 2019

Currently, ConnectionStatistics listens to the "connection closed" event, and when it happens it retrieves the connection information from the Connection object passed in the event.

Would be great if this information could be split per-protocol.

This would involve:

  1. a new Connection.getProtocol() method so that it would be possible to know what protocol was that connection speaking
  2. a different implementation of ConnectionStatistics to store per-protocol information (as well as the totals)
  3. Possibly a ConnectionStatisticsMBean that displays the per-protocol data in a JMX friendly way. JMX's CompositeType represents a struct; in this case it can have these fields: [protocol, bytesIn, bytesOut, messagesIn, messagesOut]. JMX's CompositeData is an instance of the struct with the actual values for those fields. JMX's TabularData is a Map where you can map a String to a CompositeData (I think - this class is so obscure I completely forgotten it was so obscure). Point being that either via an array of CompositeData, or via TabularData we can return the connection information split by protocol.
@stale
Copy link

stale bot commented Oct 11, 2020

This issue has been automatically marked as stale because it has been a full year without activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Stale For auto-closed stale issues and pull requests label Oct 11, 2020
@lachlan-roberts
Copy link
Contributor

@sbordet we now have IncludeExcludeConnectionStatistics which can can only record stats for specific types of connection. This can be used to get stats for a specific protocol, for the websocket protocol we get stats by including org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.

However this would be a much cleaner solution to have all the information in ConnectionStatistics instead of having multiple IncludeExcludeConnectionStatistics for different protocols.

@stale stale bot removed the Stale For auto-closed stale issues and pull requests label Oct 12, 2020
@github-actions
Copy link

github-actions bot commented Mar 4, 2022

This issue has been automatically marked as stale because it has been a
full year without activity. It will be closed if no further activity occurs.
Thank you for your contributions.

@github-actions github-actions bot added the Stale For auto-closed stale issues and pull requests label Mar 4, 2022
@sbordet sbordet removed the Stale For auto-closed stale issues and pull requests label Mar 4, 2022
@joakime joakime added the Pinned Issues that never go stale label Mar 4, 2022
@arsenalzp
Copy link
Contributor

Hello,
Is this issue still valid?

@sbordet
Copy link
Contributor Author

sbordet commented Sep 27, 2024

@arsenalzp yes, it is still valid.

@arsenalzp
Copy link
Contributor

I take it, if it's possible!

@sbordet
Copy link
Contributor Author

sbordet commented Sep 27, 2024

Please do.

@arsenalzp
Copy link
Contributor

arsenalzp commented Oct 15, 2024

I've just found per-protocol ConnectionStatistics reports have already been implemented:

public void onClosed(Connection connection)
{
        if (!isStarted())
            return;
        onTotalClosed(connection);
        onConnectionClosed(connection);
}

However, protocol name is taken from class name of the connection instance:

protected void onConnectionClosed(Connection connection)
{
        Stats stats = _statsMap.get(connection.getClass().getName());
        if (stats != null)
            onClosed(stats, connection);
}

So, I propose:

  1. add Connection.getProtocol() method to get protocol name, for example for HttpConnection it is getHttpVersion().asString();

  2. look at all connection implementations to check was getProtocol method implemented and correct information is returned;

  3. rewrite ConnectionStatistics to use Connection.getProtocol() instead of Connection.getClass().getName();

  4. try to implement ConnectionStatisticsMBean for JMX.

@sbordet
Copy link
Contributor Author

sbordet commented Oct 16, 2024

@arsenalzp I forgot that this was done already 🤦🏼‍♂️

I think we can just close this issue.

I don't see much value adding Connection.getProtocol().

However, the ConnectionStatisticsMBean can definitely be improved.
@arsenalzp would you like to look at improving ConnectionStatisticsMBean by using JMX open types?
See the first comment: ConnectionStatistics.Stats should be converted to a TabularData.
As usual, comment here for directions/help, and I'll help you out.
Thanks!

@arsenalzp
Copy link
Contributor

@arsenalzp I forgot that this was done already 🤦🏼‍♂️

I think we can just close this issue.

I don't see much value adding Connection.getProtocol().

However, the ConnectionStatisticsMBean can definitely be improved. @arsenalzp would you like to look at improving ConnectionStatisticsMBean by using JMX open types? See the first comment: ConnectionStatistics.Stats should be converted to a TabularData. As usual, comment here for directions/help, and I'll help you out. Thanks!

Yes,
I cat try to improve it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

4 participants