juno icon indicating copy to clipboard operation
juno copied to clipboard

Active rpc connections metric

Open Exca-DK opened this issue 1 year ago • 2 comments

Issue

Juno now has persistent connections (eg. ws conns) with not much info about them. It would be nice if It was known to user how many of them there are.

Implementation

Do you have ideas regarding the implementation of this feature? yes Are you willing to implement this feature? yes

Scope:

  • Using gauge for tracking the amount of connections
  • Extending NewRequestListener with OnNewConnection(conn net.Conn) and OnDisconnect(conn net.Conn).
  • Implementing the logic in each jsonrpc handler.

Additional Information:

  • OnNewConnection(conn net.Conn) and OnDisconnect(conn net.Conn) would be a nice place for uniform logging eg. ("Accepted connection", "conn", conn.RemoteAddr())
  • OnNewConnection(conn net.Conn) could be further extended into OnNewConnection(conn net.Conn) net.Conn which would enable tracking how much bytes were sent/recv.

Exca-DK avatar Dec 02 '23 22:12 Exca-DK

Very nice idea.

Implementing the logic in each rpc handler.

We would only need to implement this in the websocket transport in the jsonrpc package, correct? No need to modify the higher-level rpc package handlers.

joshklop avatar Dec 02 '23 22:12 joshklop

yes, I meant jsonrpc

Exca-DK avatar Dec 03 '23 00:12 Exca-DK