Streamlit catches python errors/exceptions and displays them in a nice frontend widget.
How do I connect Sentry to Streamlit to log these errors?
Simply use loggin library:
logging.error("Test")
Have you tried using the Sentry python snippet?
You can get that snippet when you create a new Sentry Project.
This should looks something like:
import sentry_sdk
sentry_sdk.init(
dsn=<your dsn here>,
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
# We recommend adjusting this value in production.
traces_sample_rate=1.0
)
I had to add sentry_sdk to the requirements file and flag my logging as errors to get them to appear in the Sentry UI webpage. Also, I replaced dsn=<your dsn here>
with just the http endpoint from Sentry (stored as a Streamlit secret).