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
Use Sentry with Temporal to track and manage warnings within workflows.
Describe the bug
Sentry’s catch_warnings context manager, which relies on the standard Python warnings module, raises a KeyError in Temporal workflows because the warnings module is not available. This happens in environments managed by Temporal, which restricts access to certain standard Python modules like warnings.
This restriction leads to a failure when using libraries like Sentry that depend on this module for capturing and managing Python warnings.
Error Example:
KeyError: 'warnings'
Cause: The warnings module is not present or accessible within the Temporal workflow environment, causing the code to fail when it tries to reference sys.modules['warnings'].
Minimal Reproduction
To reproduce this issue:
1. Set up a Temporal workflow in Python.
2. Integrate Sentry’s catch_warnings context manager or any other library that uses the warnings module.
3. Trigger a Python warning within the workflow (e.g., by using warnings.warn()).
4. The workflow fails with a KeyError: 'warnings' due to the restricted access.
Here’s a minimal code snippet:
def workflow_function():
with warnings.catch_warnings(record=True) as w:
warnings.warn("This is a test warning")
Environment/Versions
• OS and processor: MacBook Pro M1
• Temporal Version: 1.7.1
• Are you using Docker or Kubernetes?: Using Docker to run Temporal
The text was updated successfully, but these errors were encountered:
What are you really trying to do?
Use Sentry with Temporal to track and manage warnings within workflows.
Describe the bug
Sentry’s catch_warnings context manager, which relies on the standard Python warnings module, raises a KeyError in Temporal workflows because the warnings module is not available. This happens in environments managed by Temporal, which restricts access to certain standard Python modules like warnings.
This restriction leads to a failure when using libraries like Sentry that depend on this module for capturing and managing Python warnings.
Error Example:
Cause: The warnings module is not present or accessible within the Temporal workflow environment, causing the code to fail when it tries to reference sys.modules['warnings'].
Minimal Reproduction
To reproduce this issue:
Here’s a minimal code snippet:
Environment/Versions
The text was updated successfully, but these errors were encountered: