What does this actually count?
According to the code of this class, it measure the following points:
- Messages received by tracked connections
- Messages sent by tracked connections
- Bytes received by tracked connections
- Bytes sent by tracked connections
- The maximum number of observed connections over a rolling 2-minute interval
- The current number of open Jetty connections
What does tracked mean here?
Because JettyConnectionMetrics
is Jetty’s Connection.Listener
, when registered into a Connector
, it’ll track all open
and close
events, i.e. whenever an I/O event occurs on that connector.
If I add it to our (only one) connector will it contain every bytes received by the TCP connection?
Yes, if you are using ServerConnector
, that is the primary connector for the Jetty server over TCP/IP.
I am right that it is updated only on connection close which could delay data when there is a HAProxy between real clients and Jetty (with keep-alive connections)?
Yes, you’re right, that is updated only when a connection closes. Depending how is this important for your metrics, you may consider disabling keep-alive
connections and require always that connections get closed (make sure you understand the trade-offs of this change).
CLICK HERE to find out more related problems solutions.