armeria
armeria copied to clipboard
Provide better observability into `KeepAliveHandler`
I propose that better observability is offered for KeepAliverHandler.
While users can check logs to verify why a connection was closed, it may be easier to export this in some other way (e.g. metrics) so that users can easily verify/monitor changes.
I propose an API like the following is added to the ConnectionPoolListener API
enum CloseReason {
PING_TIMEOUT,
CONNECTION_IDLE,
MAX_CONNECTION_AGE,
UNKNOWN,
}
default void onCloseEvent(SessionProtocol protocol,
Channel channel,
CloseReason reason) {}
default void onPingSent(SessionProtocol protocol,
Channel channel,
long data) {}
default void onPingReceived(SessionProtocol protocol,
Channel channel,
long data) {}
ref: https://github.com/jrhee17/armeria/tree/poc/keepalive-observe ref: https://discord.com/channels/1087271586832318494/1445319892076200057
@yzfeng2020
Also pinging @line/dx for thoughts/design review
I agree with the overall direction.
thanks for it, I like it as well!