Skip to content

Commit 1447ec0

Browse files
committed
added optional Sentry integration
1 parent 838ad69 commit 1447ec0

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ pyparsing==2.4.7
1212
pytest==6.2.3
1313
soupsieve==2.2.1
1414
toml==0.10.2
15+
sentry-sdk==1.5.10

src/epp/rpc_server.py

+18
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,12 @@ def main():
368368
dest="verbose_poll",
369369
help="also enable logging for poll requests and responses",
370370
)
371+
p.add_option(
372+
'--sentry_dsn',
373+
'-s',
374+
help="Sentry DSN url to enable error reporting to remote system",
375+
default="",
376+
)
371377

372378
options, _ = p.parse_args()
373379

@@ -379,6 +385,18 @@ def main():
379385
)
380386
logging.getLogger('pika').setLevel(logging.WARNING)
381387

388+
if options.sentry_dsn:
389+
import sentry_sdk
390+
from sentry_sdk.integrations.logging import LoggingIntegration
391+
sentry_logging = LoggingIntegration(
392+
level=logging.INFO,
393+
event_level=logging.ERROR,
394+
)
395+
sentry_sdk.init(
396+
dsn=options.sentry_dsn,
397+
integrations=[sentry_logging, ],
398+
)
399+
382400
srv = EPP_RPC_Server(
383401
epp_params=open(options.epp, 'r').read().strip().split(' '),
384402
rabbitmq_params=open(options.rabbitmq, 'r').read().strip().split(' '),

0 commit comments

Comments
 (0)