You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to monitor my Streamlit app with Sentry.io so that errors can be easily detected and key metrics are captured.
How are you getting stuck?
I created the following util logging file - logging.py
import streamlit as st
import sentry_sdk
import logging
sentry_sdk.init(
dsn={my DSN URL},
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
traces_sample_rate=1.0,
# Set profiles_sample_rate to 1.0 to profile 100%
# of sampled transactions.
# We recommend adjusting this value in production.
profiles_sample_rate=1.0,
enable_tracing=True
)
# Configure logging (adjust level as needed)
logging.basicConfig(level=logging.DEBUG)
st_logger = logging.getLogger('streamlit')
st_logger.setLevel(logging.INFO)
In every page and util script, I import this util file and I have seen that metrics are now captured. However, I have not noticed any errors appearing.
The errors do not show up in Sentry, because the Sentry SDK only captures unhandled errors and sends them to Sentry. Streamlit is handling the errors (and displays them) so the Sentry SDK never gets to see the errors.
Unfortunately we do not have a Streamlit integration that would do the sending of those handled Streamlit errors.
The solution would be to find the function in streamlit that handles errors and then wrap this function with a custom function that sends the error to Sentry and then calls the original Streamlit error handling function. (this is what our integrations for all the other Python frameworks do)
Environment
SaaS (https://sentry.io/)
What are you trying to accomplish?
I want to monitor my Streamlit app with Sentry.io so that errors can be easily detected and key metrics are captured.
How are you getting stuck?
I created the following util logging file -
logging.py
In every page and util script, I import this util file and I have seen that metrics are now captured. However, I have not noticed any errors appearing.
Errors will display in my app as Streamlit Exceptions (https://docs.streamlit.io/develop/api-reference/status/st.exception) but they are not captured as issues.
Where in the product are you?
Issues
Link
No response
DSN
No response
Version
No response
The text was updated successfully, but these errors were encountered: