summaryrefslogtreecommitdiffstats
path: root/fatcat_scholar/worker.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2021-01-30 19:05:13 -0800
committerBryan Newbold <bnewbold@archive.org>2021-01-30 19:05:15 -0800
commite86414a774d4a0c6db62110f04a6c96365afbf6c (patch)
treeb6d762223017dbd12f2b10a0242548702295072d /fatcat_scholar/worker.py
parent64e4a0b3c43b53f5c79e6f17a189c7f5ec113c5b (diff)
downloadfatcat-scholar-e86414a774d4a0c6db62110f04a6c96365afbf6c.tar.gz
fatcat-scholar-e86414a774d4a0c6db62110f04a6c96365afbf6c.zip
enable sentry exceptions for workers and pipelines
It is otherwise difficult to debug multi-million record pipelines.
Diffstat (limited to 'fatcat_scholar/worker.py')
-rw-r--r--fatcat_scholar/worker.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/fatcat_scholar/worker.py b/fatcat_scholar/worker.py
index fb806a7..854c1a2 100644
--- a/fatcat_scholar/worker.py
+++ b/fatcat_scholar/worker.py
@@ -6,12 +6,13 @@ import datetime
from typing import List, Any
import requests
+import sentry_sdk
import elasticsearch
import elasticsearch.helpers
import fatcat_openapi_client
from fatcat_openapi_client import ReleaseEntity
-from fatcat_scholar.config import settings
+from fatcat_scholar.config import settings, GIT_REVISION
from fatcat_scholar.issue_db import IssueDB
from fatcat_scholar.sandcrawler import (
SandcrawlerPostgrestClient,
@@ -198,6 +199,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,
+ )
+
if args.worker == "fetch-docs-worker":
issue_db = IssueDB(args.issue_db_file)
wp = WorkPipeline(