deephaven-core icon indicating copy to clipboard operation
deephaven-core copied to clipboard

feat: log session ID and user-agent

Open devinrsmith opened this issue 1 year ago • 1 comments

Logs the session ID and user-agent (if set) on session creation. Technically, the user-agent could change with each RPC call, but that is not something that clients typically do. For contexts where logging every session is too spammy, the configuration property SessionListenerLogger.level can be used to set the appropriate log level.

Note, the user agent interceptor is not able to be bound to Set<ServerInterceptor> as it causes an undefined ordering with respect to SessionServiceInterceptor; we need to ensure that the user agent interceptor is applied before the session service interceptor.

Server component of #5704

devinrsmith avatar Aug 27 '24 20:08 devinrsmith

Here's an example of connecting from a browser:

2024-08-27T20:28:25.263Z | qtp1540031691-111    |  INFO | s.s.SessionListenerLogger | onSessionCreated, id=273f26d4-53f9-4f3c-a118-0d317348a42e, userAgent=Mozilla/5.0 (X11; Linux x86_64; rv:129.0) Gecko/20100101 Firefox/129.0

Here's an example of connect-check:

2024-08-27T20:29:00.030Z | qtp1540031691-111    |  INFO | s.s.SessionListenerLogger | onSessionCreated, id=a3adb37e-6710-45c2-b45b-46f1c2e9a9df, userAgent=grpc-java/1.58.0 (deephaven/0.37.0-SNAPSHOT; deephaven-session-examples) grpc-java-netty/1.58.0

devinrsmith avatar Aug 27 '24 20:08 devinrsmith