-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Shiny has an session$allowReconnect() method that allows apps to enable automatic client reconnection when the network connection is lost. This method sends a control message to the client (TRUE, FALSE, or "force") to determine whether automatic reconnection is allowed.
Currently, OTEL tracing in Shiny covers:
- Session lifecycle events (session_start, session_end spans )
- Reactive updates and expressions
- Error handling and logging
- Custom events and labels
However, there is no OTEL event/span created when session$allowReconnect() is called, which means we cannot track which sessions have reconnection enabled in the trace data. Additionally, when a client reconnects after a network interruption, it's unclear how to correlate the new session with the previous session in OTEL traces.
Problem: When a client disconnects and reconnects:
The client typically creates a new session object on the server
The new session gets a new session.id (token)
Current OTEL spans are tied to the original session ID, making it hard to trace the reconnection event
Some feasible options
- Option A (Recommended): Reuse session ID on reconnection
- Option B: Link previous session ID as trace context