Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7066639
D2515.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D2515.diff
View Options
diff --git a/swh/scheduler/celery_backend/config.py b/swh/scheduler/celery_backend/config.py
--- a/swh/scheduler/celery_backend/config.py
+++ b/swh/scheduler/celery_backend/config.py
@@ -24,6 +24,7 @@
from swh.scheduler import CONFIG as SWH_CONFIG
from swh.core.config import load_named_config, merge_configs
+from swh.core.sentry import init_sentry
try:
from swh.core.logger import JournalHandler
@@ -144,16 +145,13 @@
@worker_init.connect
@_print_errors
def on_worker_init(*args, **kwargs):
- sentry_dsn = os.environ.get('SWH_SENTRY_DSN')
- if sentry_dsn:
- import sentry_sdk
+ try:
from sentry_sdk.integrations.celery import CeleryIntegration
-
- sentry_sdk.init(
- dsn=sentry_dsn,
- integrations=[CeleryIntegration()],
- debug=bool(os.environ.get('SWH_SENTRY_DEBUG')),
- )
+ except ImportError:
+ integrations = []
+ else:
+ integrations = [CeleryIntegration()]
+ init_sentry(integrations=integrations)
@Panel.register
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Nov 5 2024, 5:03 PM (11 w, 15 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3223437
Attached To
D2515: Use swh.core.sentry instead of calling sentry_sdk.init directly.
Event Timeline
Log In to Comment