Added sentry stuff
This commit is contained in:
		@@ -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()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user