mirror of
https://github.com/ComputerScienceHouse/proxstar.git
synced 2025-02-12 13:01:51 +00:00
Add sentry with integrations (#32)
* Add sentry with integrations * Remove raven references from python code
This commit is contained in:
parent
1ee7198363
commit
71d33bf7ec
3 changed files with 13 additions and 1 deletions
|
@ -60,3 +60,7 @@ 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", "")
|
|
@ -13,6 +13,9 @@ 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
|
||||
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 +42,11 @@ 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()]
|
||||
)
|
||||
with open('proxmox_ssh_key', 'w') as ssh_key_file:
|
||||
ssh_key_file.write(app.config['PROXMOX_SSH_KEY'])
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue