From e86414a774d4a0c6db62110f04a6c96365afbf6c Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Sat, 30 Jan 2021 19:05:13 -0800 Subject: enable sentry exceptions for workers and pipelines It is otherwise difficult to debug multi-million record pipelines. --- fatcat_scholar/work_pipeline.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'fatcat_scholar/work_pipeline.py') diff --git a/fatcat_scholar/work_pipeline.py b/fatcat_scholar/work_pipeline.py index aef2064..cb96274 100644 --- a/fatcat_scholar/work_pipeline.py +++ b/fatcat_scholar/work_pipeline.py @@ -7,11 +7,12 @@ import urllib3.exceptions import minio import requests +import sentry_sdk import internetarchive from fatcat_openapi_client import ReleaseEntity, FileEntity, WebcaptureEntity from fatcat_scholar.api_entities import * -from fatcat_scholar.config import settings +from fatcat_scholar.config import settings, GIT_REVISION from fatcat_scholar.djvu import djvu_extract_leaf_texts from fatcat_scholar.sandcrawler import ( SandcrawlerPostgrestClient, @@ -469,6 +470,14 @@ def main() -> None: parser.print_help(file=sys.stderr) sys.exit(-1) + if settings.SENTRY_DSN: + sentry_sdk.init( + dsn=settings.SENTRY_DSN, + environment=settings.SCHOLAR_ENV, + max_breadcrumbs=10, + release=GIT_REVISION, + ) + wp = WorkPipeline( issue_db=IssueDB(args.issue_db_file), sandcrawler_db_client=SandcrawlerPostgrestClient( -- cgit v1.2.3