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
This sample shows how to configure [Sentry](https://sentry.io) to intercept and capture errors from the Temporal SDK.
3
+
This sample shows how to configure [Sentry](https://sentry.io) SDK (version 2) to intercept and capture errors from the Temporal SDK
4
+
for workflows and activities. The integration adds some useful context to the errors, such as the activity type, task queue, etc.
5
+
6
+
## Further details
7
+
8
+
This is a small modification of the original example Sentry integration in this repo based on SDK v1. The integration
9
+
didn't work properly with Sentry SDK v2 due to some internal changes in the Sentry SDK that broke the worker sandbox.
10
+
Additionally, the v1 SDK has been deprecated and is only receiving security patches and will reach EOL some time in the future.
11
+
If you still need to use Sentry SDK v1, check the original example at this [commit](https://github.com/temporalio/samples-python/blob/090b96d750bafc10d4aad5ad506bb2439c413d5e/sentry).
12
+
13
+
## Running the Sample
4
14
5
15
For this sample, the optional `sentry` dependency group must be included. To include, run:
6
16
7
-
uv sync --group sentry
17
+
uv sync --no-default-groups --dev --group sentry
18
+
19
+
> Note: this integration breaks when `gevent` is installed (e.g. by the gevent sample) so make sure to only install
20
+
> the `sentry` group and run the scripts below as described.
8
21
9
22
To run, first see [README.md](../README.md) for prerequisites. Set `SENTRY_DSN` environment variable to the Sentry DSN.
10
23
Then, run the following from the root directory to start the worker:
11
24
25
+
export SENTRY_DSN= # You'll need a Sentry account to test against
26
+
export ENVIRONMENT=dev
12
27
uv run sentry/worker.py
13
28
14
29
This will start the worker. Then, in another terminal, run the following to execute the workflow:
15
30
16
31
uv run sentry/starter.py
17
32
18
-
The workflow should complete with the hello result. If you alter the workflow or the activity to raise an
19
-
`ApplicationError` instead, it should appear in Sentry.
33
+
You should see the activity fail causing an error to be reported to Sentry.
34
+
35
+
## Screenshot
36
+
37
+
The screenshot below shows the extra tags and context included in the
38
+
Sentry error from the exception thrown in the activity.
0 commit comments