I want to know that after I deploy the apps, is there any way to find out the number of views and interaction that is happening with my app? I would like to see some kind of dashboard accessibility. Let me know if something like this is already there and I am just missing it.
Hey @shyamcody Welcome to the community !
Its not available out of the box but streamlit does use prometheus_client at /metrics endpoint to export some of the metrics. check this answer, Performance monitoring ideas?
You can utilize it using a little bit of code to count views by setting up a Counter collector for unique session_ids. I have added this functionality in my update to the state.py that I use for my streamlit apps.
Just copy the module from this gist, https://gist.github.com/ash2shukla/ff180d7fbe8ec3a0240f19f4452acde7
And import count_sessions
and call the function at the top of your script, you will be able to see
TYPE session_count_total counter
session_count_total 5.0
at /metrics endpoint. If you want to add a dashboard then you can look into Grafana, prometheus combination of things.
This piece of code,
import streamlit as st
from state import count_sessions
count_sessions()
st.write("test")
Will give you this,
Hope it helps !
Beside this there’s already an issue opened,
PS. you can add anything you want to collectors then eg. times refreshed, function run summaries etc.
Hi @shyamcody, welcome to the Streamlit community!
We are thinking about how to surface this to users, whether that’s via a dashboard in Streamlit sharing, a weekly email or something else. I don’t have a timeframe for that, but it is something we’re actively thinking about!
Best,
Randy
That’d be such a great functionnality!
hey @ash2shukla I will make sure to check it out. Thanks for such a detailed answer.