Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data Dumps: Add Sentry error logging #6319

Merged
merged 6 commits into from
Mar 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions conf/openlibrary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,5 +182,11 @@ sentry:
dsn: 'https://[email protected]/0'
environment: 'local'

sentry_cron_jobs:
enabled: false
# Dummy endpoint; where sentry logs are sent to
dsn: 'https://[email protected]/0'
environment: 'local'

# Observations cache settings:
observation_cache_duration: 86400
11 changes: 11 additions & 0 deletions openlibrary/data/dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@

import web

from infogami import config
from infogami.infobase.utils import flatten_dict
from openlibrary.config import load_config
from openlibrary.data import db
from openlibrary.data.sitemap import generate_html_index, generate_sitemaps
from openlibrary.plugins.openlibrary.processors import urlsafe
from openlibrary.utils.sentry import Sentry

logger = logging.getLogger(__file__)
logger.setLevel(logging.DEBUG)
Expand Down Expand Up @@ -372,4 +375,12 @@ def main(cmd, args):


if __name__ == "__main__":
ol_config = os.getenv("OL_CONFIG")
if ol_config:
logger.info(f"loading config from {ol_config}")
load_config(ol_config)
sentry = Sentry(getattr(config, 'sentry_cron_jobs', {}))
if sentry.enabled:
sentry.init()

main(sys.argv[1], sys.argv[2:])
1 change: 1 addition & 0 deletions scripts/oldump.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ source /home/openlibrary/.bashrc
SCRIPTS=/openlibrary/scripts
PSQL_PARAMS=${PSQL_PARAMS:-"-h db openlibrary"}
TMPDIR=${TMPDIR:-/openlibrary/dumps}
OL_CONFIG=${OL_CONFIG:-/openlibrary/conf/openlibrary.yml}

yymm=`date +\%Y-\%m`
yymmdd=$1
Expand Down