4
0
Fork 0

Added sentry stuff

This commit is contained in:
Pünkösd Marcell 2020-04-19 21:45:26 +02:00
parent 2bba3a4de9
commit 8180ec45d6
1 changed files with 17 additions and 0 deletions

View File

@ -5,6 +5,9 @@ import sys
import pika
import json
from sentry_sdk.integrations.logging import LoggingIntegration
import sentry_sdk
from extraction import run_everything
@ -16,6 +19,20 @@ def main():
logging.basicConfig(filename="", format="%(asctime)s - %(name)s [%(levelname)s]: %(message)s",
level=logging.DEBUG if '--debug' in sys.argv else logging.INFO)
SENTRY_DSN = os.environ.get("SENTRY_DSN")
if SENTRY_DSN:
sentry_logging = LoggingIntegration(
level=logging.DEBUG, # Capture info and above as breadcrumbs
event_level=logging.ERROR # Send errors as events
)
sentry_sdk.init(
dsn=SENTRY_DSN,
integrations=[sentry_logging],
send_default_pii=True,
release=os.environ.get('RELEASE_ID', 'test'),
environment=os.environ.get('RELEASEMODE', 'dev')
)
logging.info("Connecting to MQ service...")
connection = pika.BlockingConnection(pika.connection.URLParameters(os.environ['PIKA_URL']))
channel = connection.channel()