Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Sentry Sample

This sample shows how to configure Sentry SDK (version 2) to intercept and capture errors from the Temporal SDK for workflows and activities. The integration adds some useful context to the errors, such as the activity type, task queue, etc.

Note: Sentry currently does not support Python 3.14, likewise this sample does not support Python 3.14.

Further details

This is a small modification of the original example Sentry integration in this repo based on SDK v1. The integration didn't work properly with Sentry SDK v2 due to some internal changes in the Sentry SDK that broke the worker sandbox. Additionally, the v1 SDK has been deprecated and is only receiving security patches and will reach EOL some time in the future. If you still need to use Sentry SDK v1, check the original example at this commit.

Running the Sample

For this sample, the optional sentry dependency group must be included. To include, run:

uv sync --no-default-groups --dev --group sentry

Note: this integration breaks when gevent is installed (e.g. by the gevent sample) so make sure to only install the sentry group and run the scripts below as described.

To run, first see README.md for prerequisites. Set SENTRY_DSN environment variable to the Sentry DSN. Then, run the following from the root directory to start the worker:

export SENTRY_DSN=  # You'll need a Sentry account to test against
export ENVIRONMENT=dev
uv run sentry/worker.py

This will start the worker. Then, in another terminal, run the following to execute the workflow:

uv run sentry/starter.py

You should see the activity fail causing an error to be reported to Sentry.

Screenshot

The screenshot below shows the extra tags and context included in the Sentry error from the exception thrown in the activity.

Sentry screenshot