Added sentry stuff
This commit is contained in:
parent
2bba3a4de9
commit
8180ec45d6
@ -5,6 +5,9 @@ import sys
|
|||||||
import pika
|
import pika
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
from sentry_sdk.integrations.logging import LoggingIntegration
|
||||||
|
import sentry_sdk
|
||||||
|
|
||||||
from extraction import run_everything
|
from extraction import run_everything
|
||||||
|
|
||||||
|
|
||||||
@ -16,6 +19,20 @@ def main():
|
|||||||
logging.basicConfig(filename="", format="%(asctime)s - %(name)s [%(levelname)s]: %(message)s",
|
logging.basicConfig(filename="", format="%(asctime)s - %(name)s [%(levelname)s]: %(message)s",
|
||||||
level=logging.DEBUG if '--debug' in sys.argv else logging.INFO)
|
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...")
|
logging.info("Connecting to MQ service...")
|
||||||
connection = pika.BlockingConnection(pika.connection.URLParameters(os.environ['PIKA_URL']))
|
connection = pika.BlockingConnection(pika.connection.URLParameters(os.environ['PIKA_URL']))
|
||||||
channel = connection.channel()
|
channel = connection.channel()
|
||||||
|
Reference in New Issue
Block a user