Is there a way to know how many active sessions are running on my streamlit server app at any specific instant?
I am not using streamlit cloud, and my app is deployed in my private cloud.
How can I get some server analytics?
Thanks.
Is there a way to know how many active sessions are running on my streamlit server app at any specific instant?
I am not using streamlit cloud, and my app is deployed in my private cloud.
How can I get some server analytics?
Thanks.
Hey there, thanks for your thoughtful question!
If you’re running Streamlit on your own private cloud (not Streamlit Community Cloud), Streamlit does not provide built-in server analytics or a direct API to count active sessions out of the box. However, each browser tab or window creates a separate session, and Streamlit manages these using WebSockets, but it doesn’t expose a public API for session tracking in self-hosted deployments according to the official docs and architecture guides (Streamlit Architecture).
For custom analytics, you can use workarounds like:
session_id in _BrowserWebSocketHandler.open()), or/metrics endpoint to count sessions, as described in this forum post, orIf you want to try the Prometheus approach, check out the code snippet in the forum post for counting sessions. For more advanced analytics, consider integrating with external tools like Grafana or custom logging.
Sources: