-
Notifications
You must be signed in to change notification settings - Fork 969
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
Jetty Connector Metrics are only reported onClosed #3873
Comments
So what would be the expected outcome? Would you want the metrics to be available as gauges? |
No, counters are fine, but metrics should be recorded when bytes are sent / received instead of on connection closure. |
I see, so instead of doing a listener on the connection, most likely we should be using the public interface NetworkTrafficListener
{
/**
* <p>Callback method invoked when a connection from a remote client has been accepted.</p>
* <p>The {@code socket} parameter can be used to extract socket address information of
* the remote client.</p>
*
* @param socket the socket associated with the remote client
*/
default void opened(Socket socket)
{
}
/**
* <p>Callback method invoked when bytes sent by a remote client arrived on the server.</p>
*
* @param socket the socket associated with the remote client
* @param bytes the read-only buffer containing the incoming bytes
*/
default void incoming(Socket socket, ByteBuffer bytes)
{
}
/**
* <p>Callback method invoked when bytes are sent to a remote client from the server.</p>
* <p>This method is invoked after the bytes have been actually written to the remote client.</p>
*
* @param socket the socket associated with the remote client
* @param bytes the read-only buffer containing the outgoing bytes
*/
default void outgoing(Socket socket, ByteBuffer bytes)
{
} |
before this change we were dumping in / out bytes from the connection upon the connection close which could result in big traffic whenever the connection got closed after this change we're measuring the bytes through NetworkTrafficListener that hooks in whenever actual in / out bytes are being processed fixes gh-3873
I'm no expert in Jetty, but after changing the @Override
public void incoming(Socket socket, ByteBuffer bytes) {
bytesIn.record(bytes.limit());
}
@Override
public void outgoing(Socket socket, ByteBuffer bytes) {
bytesOut.record(bytes.limit());
} I can make the tests pass on the server side (I return the same amount of bytes), but I have a difference in bytes between what we are returning when the connection gets closed vs when the outgoing bytes get reported through the In case of With the Are there any Jetty experts that can explain this? Maybe I'm misusing the |
before this change we were dumping in / out bytes from the connection upon the connection close which could result in big traffic whenever the connection got closed after this change we're measuring the bytes through NetworkTrafficListener that hooks in whenever actual in / out bytes are being processed fixes gh-3873
before this change we were dumping in / out bytes from the connection upon the connection close which could result in big traffic whenever the connection got closed after this change we're measuring the bytes through NetworkTrafficListener that hooks in whenever actual in / out bytes are being processed fixes gh-3873
before this change we were dumping in / out bytes from the connection upon the connection close which could result in big traffic whenever the connection got closed after this change we're measuring the bytes through NetworkTrafficListener that hooks in whenever actual in / out bytes are being processed fixes gh-3873
before this change we were dumping in / out bytes from the connection upon the connection close which could result in big traffic whenever the connection got closed after this change we're measuring the bytes through NetworkTrafficListener that hooks in whenever actual in / out bytes are being processed fixes gh-3873
before this change we were dumping in / out bytes from the connection upon the connection close which could result in big traffic whenever the connection got closed after this change we're measuring the bytes through NetworkTrafficListener that hooks in whenever actual in / out bytes are being processed. This only works on the server-side connection for now. Future versions of Jetty may extend it to client side. fixes gh-3873
Describe the bug
io.micrometer.core.instrument.binder.jetty.JettyConnectionMetrics
reports metrics only inonClosed
. Thus, connections receiving lots of traffic / messages but that are kept open, will never be visible in the metrics, then create a high peak at closure.Environment
To Reproduce
Keep the connection in the client open (e.g. OkHttp and send a request every minute - default idle time is 5 minutes).
Expected behavior
Traffic being visible in the reported metrics.
The text was updated successfully, but these errors were encountered: