aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xpython/fatcat_cleanup.py4
-rwxr-xr-xpython/fatcat_harvest.py5
-rwxr-xr-xpython/fatcat_import.py4
-rwxr-xr-xpython/fatcat_ingest.py4
-rwxr-xr-xpython/fatcat_review.py4
-rw-r--r--python/fatcat_web/__init__.py6
-rw-r--r--python/fatcat_web/web_config.py9
-rwxr-xr-xpython/fatcat_worker.py4
8 files changed, 12 insertions, 28 deletions
diff --git a/python/fatcat_cleanup.py b/python/fatcat_cleanup.py
index b5e50425..b2bd4f0f 100755
--- a/python/fatcat_cleanup.py
+++ b/python/fatcat_cleanup.py
@@ -9,9 +9,6 @@ import sentry_sdk
from fatcat_tools import authenticated_api
from fatcat_tools.cleanups import FileCleaner, JsonLinePusher
-# Yep, a global. Gets DSN from `SENTRY_DSN` environment variable
-sentry_client = sentry_sdk.init()
-
def run_files(args: argparse.Namespace) -> None:
fmi = FileCleaner(
@@ -71,6 +68,7 @@ def main() -> None:
# token is an optional kwarg (can be empty string, None, etc)
token=os.environ.get(args.auth_var),
)
+ sentry_sdk.init(environment=args.env)
args.func(args)
diff --git a/python/fatcat_harvest.py b/python/fatcat_harvest.py
index 4180dc16..8d86bca7 100755
--- a/python/fatcat_harvest.py
+++ b/python/fatcat_harvest.py
@@ -15,9 +15,6 @@ from fatcat_tools.harvest import (
PubmedFTPWorker,
)
-# Yep, a global. Gets DSN from `SENTRY_DSN` environment variable
-sentry_client = sentry_sdk.init()
-
def run_crossref(args: argparse.Namespace) -> None:
worker = HarvestCrossrefWorker(
@@ -145,6 +142,8 @@ def main() -> None:
if not args.__dict__.get("func"):
print("tell me what to do!")
sys.exit(-1)
+
+ sentry_sdk.init(environment=args.env)
args.func(args)
diff --git a/python/fatcat_import.py b/python/fatcat_import.py
index 5c480fc5..d9f049ae 100755
--- a/python/fatcat_import.py
+++ b/python/fatcat_import.py
@@ -44,9 +44,6 @@ from fatcat_tools.importers import (
SqlitePusher,
)
-# Yep, a global. Gets DSN from `SENTRY_DSN` environment variable
-sentry_client = sentry_sdk.init()
-
def run_crossref(args: argparse.Namespace) -> None:
fci = CrossrefImporter(
@@ -1022,6 +1019,7 @@ def main() -> None:
# token is an optional kwarg (can be empty string, None, etc)
token=os.environ.get(args.auth_var),
)
+ sentry_sdk.init(environment=args.env)
args.func(args)
diff --git a/python/fatcat_ingest.py b/python/fatcat_ingest.py
index 3f8666ca..d56725c0 100755
--- a/python/fatcat_ingest.py
+++ b/python/fatcat_ingest.py
@@ -17,9 +17,6 @@ from elasticsearch_dsl import Q, Search
from fatcat_tools import kafka_fail_fast, public_api, simple_kafka_producer
from fatcat_tools.transforms import release_ingest_request
-# Yep, a global. Gets DSN from `SENTRY_DSN` environment variable
-sentry_client = sentry_sdk.init()
-
def _init_search(args: argparse.Namespace) -> Search:
@@ -267,6 +264,7 @@ def main() -> None:
sys.exit(-1)
args.api = public_api(args.fatcat_api_url)
+ sentry_sdk.init(environment=args.env)
args.func(args)
diff --git a/python/fatcat_review.py b/python/fatcat_review.py
index 05a00681..599aeea3 100755
--- a/python/fatcat_review.py
+++ b/python/fatcat_review.py
@@ -8,9 +8,6 @@ import sentry_sdk
from fatcat_tools import authenticated_api
from fatcat_tools.reviewers import DummyReviewBot
-# Yep, a global. Gets DSN from `SENTRY_DSN` environment variable
-sentry_client = sentry_sdk.init()
-
def run_dummy(args: argparse.Namespace) -> None:
reviewer = DummyReviewBot(args.api, poll_interval=args.poll_interval, verbose=args.verbose)
@@ -60,6 +57,7 @@ def main() -> None:
sys.exit(-1)
args.api = authenticated_api(args.fatcat_api_url)
+ sentry_sdk.init(environment=args.env)
args.func(args)
diff --git a/python/fatcat_web/__init__.py b/python/fatcat_web/__init__.py
index 9877d98e..0725c2e2 100644
--- a/python/fatcat_web/__init__.py
+++ b/python/fatcat_web/__init__.py
@@ -45,7 +45,11 @@ login_manager.login_view = "/auth/login"
oauth = OAuth(app)
# Grabs sentry config from SENTRY_DSN environment variable
-sentry_sdk.init(integrations=[FlaskIntegration()])
+sentry_sdk.init(
+ integrations=[FlaskIntegration()],
+ release=Config.GIT_RELEASE,
+ environment=Config.FATCAT_DOMAIN,
+)
conf = fatcat_openapi_client.Configuration()
conf.host = Config.FATCAT_API_HOST
diff --git a/python/fatcat_web/web_config.py b/python/fatcat_web/web_config.py
index fb3b55ab..904189d6 100644
--- a/python/fatcat_web/web_config.py
+++ b/python/fatcat_web/web_config.py
@@ -157,12 +157,3 @@ class Config(object):
except Exception as e:
print("WARNING: couldn't set sentry git release automatically: " + str(e))
GIT_RELEASE = None
-
- SENTRY_CONFIG = {
- #'include_paths': ['fatcat_web', 'fatcat_openapi_client', 'fatcat_tools'],
- "enable-threads": True, # for uWSGI
- "release": GIT_RELEASE,
- "tags": {
- "fatcat_domain": FATCAT_DOMAIN,
- },
- }
diff --git a/python/fatcat_worker.py b/python/fatcat_worker.py
index a7dcf755..70d172f7 100755
--- a/python/fatcat_worker.py
+++ b/python/fatcat_worker.py
@@ -15,9 +15,6 @@ from fatcat_tools.workers import (
EntityUpdatesWorker,
)
-# Yep, a global. Gets DSN from `SENTRY_DSN` environment variable
-sentry_client = sentry_sdk.init()
-
def run_changelog(args: argparse.Namespace) -> None:
topic = "fatcat-{}.changelog".format(args.env)
@@ -200,6 +197,7 @@ def main() -> None:
sys.exit(-1)
args.api = public_api(args.api_host_url)
+ sentry_sdk.init(environment=args.env)
args.func(args)