Add sentry rq integration

This commit is contained in:
Max Meinhold 2020-10-11 13:26:45 -04:00
parent b9bd1d4e14
commit c80b240497
No known key found for this signature in database
GPG key ID: 00B8B1017EEC103F
3 changed files with 14 additions and 2 deletions

View file

@ -15,6 +15,7 @@ from sqlalchemy.orm import sessionmaker
from flask import Flask, render_template, request, redirect, session, abort, url_for
import sentry_sdk
from sentry_sdk.integrations.flask import FlaskIntegration
from sentry_sdk.integrations.rq import RqIntegration
from sentry_sdk.integrations.sqlalchemy import SqlalchemyIntegration
from proxstar.db import (Base, datetime, get_pool_cache, renew_vm_expire, set_user_usage_limits, get_template,
get_templates, get_allowed_users, add_ignored_pool, delete_ignored_pool, add_allowed_user,
@ -42,11 +43,13 @@ else:
app.config.from_pyfile(config)
app.config['GIT_REVISION'] = subprocess.check_output(
['git', 'rev-parse', '--short', 'HEAD']).decode('utf-8').rstrip()
# Sentry setup
sentry_sdk.init(
dsn=app.config['SENTRY_DSN'],
integrations=[FlaskIntegration(), SqlalchemyIntegration()]
integrations=[FlaskIntegration(), RqIntegration(), SqlalchemyIntegration()]
)
with open('proxmox_ssh_key', 'w') as ssh_key_file:
ssh_key_file.write(app.config['PROXMOX_SSH_KEY'])

9
rqsettings.py Normal file
View file

@ -0,0 +1,9 @@
import os
import sentry_sdk
from sentry_sdk.integrations.rq import RqIntegration
sentry_sdk.init(
os.environ.get('PROXSTAR_SENTRY_DSN'),
integrations=[RqIntegration()]
)

View file

@ -1,3 +1,3 @@
#!/bin/sh
/opt/app-root/bin/rq worker -u "$PROXSTAR_REDIS_URL" --sentry-dsn "$PROXSTAR_SENTRY_DSN"
/opt/app-root/bin/rq worker -u "$PROXSTAR_REDIS_URL" --sentry-dsn "" -c rqsettings