Add sentry with integrations

This commit is contained in:
Galen Guyer 2019-11-03 21:07:14 -05:00
parent 1ee7198363
commit 3a4dbc7c31
No known key found for this signature in database
GPG key ID: 6E39D00D77389D4E
3 changed files with 18 additions and 1 deletions

View file

@ -60,3 +60,10 @@ WEBSOCKIFY_PATH = environ.get('PROXSTAR_WEBSOCKIFY_PATH',
'/opt/app-root/bin/websockify')
WEBSOCKIFY_TARGET_FILE = environ.get('PROXSTAR_WEBSOCKIFY_TARGET_FILE',
'/opt/app-root/src/targets')
# SENTRY
# Do not set the DSN for local development
SENTRY_DSN = environ.get("CONDITIONAL_SENTRY_DSN", "")
SENTRY_CONFIG = {
'dsn': environ.get("CONDITIONAL_SENTRY_DSN", "")
}

View file

@ -13,6 +13,10 @@ from rq_scheduler import Scheduler
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from flask import Flask, render_template, request, redirect, session, abort, url_for
from raven.contrib.flask import Sentry
import sentry_sdk
from sentry_sdk.integrations.flask import FlaskIntegration
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,
delete_allowed_user,
@ -39,7 +43,12 @@ 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 = Sentry(app)
sentry_sdk.init(
dsn=app.config['SENTRY_DSN'],
integrations=[FlaskIntegration(), SqlalchemyIntegration()]
)
with open('proxmox_ssh_key', 'w') as ssh_key_file:
ssh_key_file.write(app.config['PROXMOX_SSH_KEY'])

View file

@ -19,3 +19,4 @@ tenacity==5.0.2
websockify==0.8.0
pylint==2.3.1
pylint-quotes==0.2.1
sentry-sdk~=0.13.1