File tree Expand file tree Collapse file tree 4 files changed +25
-0
lines changed
Expand file tree Collapse file tree 4 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 66
77import aiohttp
88import logging
9+ import sentry_sdk
910import signal
1011import urllib .parse
1112from threading import Event
4041graceful_terminate_event = Event ()
4142http_bearer_scheme = HTTPBearer ()
4243
44+ if CONFIG .sentry_dsn :
45+ sentry_sdk .init (
46+ dsn = CONFIG .sentry_dsn ,
47+ traces_sample_rate = CONFIG .sentry_traces_sample_rate ,
48+ environment = CONFIG .sentry_environment ,
49+ ignore_errors = [
50+ ConnectionResetError
51+ ],
52+ )
4353
4454def get_celery_task_result (task_id : str , timeout : int = 1 ) -> tuple :
4555 """
Original file line number Diff line number Diff line change @@ -384,3 +384,6 @@ class SchedulerConfig(CeleryConfig):
384384 working_directory : str = '/srv/alts/scheduler'
385385 jwt_secret : str
386386 hashing_algorithm : str = 'HS256'
387+ sentry_dsn : str = None
388+ sentry_traces_sample_rate : float = 0.2
389+ sentry_environment : str = 'dev'
Original file line number Diff line number Diff line change 11import itertools
22import logging
3+ import sentry_sdk
34
45from celery import Celery
56from kombu import Exchange , Queue
3233celery_app .conf .task_default_exchange = 'default'
3334celery_app .conf .task_default_routing_key = 'default'
3435
36+ if CONFIG .sentry_dsn :
37+ sentry_sdk .init (
38+ dsn = CONFIG .sentry_dsn ,
39+ traces_sample_rate = CONFIG .sentry_traces_sample_rate ,
40+ environment = CONFIG .sentry_environment ,
41+ ignore_errors = [
42+ ConnectionResetError
43+ ],
44+ )
45+
3546if CONFIG .use_ssl :
3647 if not getattr (CONFIG , 'ssl_config' ):
3748 raise ValueError ('Empty SSL configuration section' )
Original file line number Diff line number Diff line change @@ -12,5 +12,6 @@ pulpcore-client==3.61.0
1212pydantic==2.9.2
1313pyone==6.10.0
1414requests==2.32.3
15+ sentry-sdk==2.22.0
1516syncer==2.0.3
1617tap.py==3.1
You can’t perform that action at this time.
0 commit comments