mirror of
https://github.com/ComputerScienceHouse/proxstar.git
synced 2025-02-14 22:11:51 +00:00
Add sentry with integrations
This commit is contained in:
parent
1ee7198363
commit
3a4dbc7c31
3 changed files with 18 additions and 1 deletions
|
@ -60,3 +60,10 @@ WEBSOCKIFY_PATH = environ.get('PROXSTAR_WEBSOCKIFY_PATH',
|
||||||
'/opt/app-root/bin/websockify')
|
'/opt/app-root/bin/websockify')
|
||||||
WEBSOCKIFY_TARGET_FILE = environ.get('PROXSTAR_WEBSOCKIFY_TARGET_FILE',
|
WEBSOCKIFY_TARGET_FILE = environ.get('PROXSTAR_WEBSOCKIFY_TARGET_FILE',
|
||||||
'/opt/app-root/src/targets')
|
'/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", "")
|
||||||
|
}
|
|
@ -13,6 +13,10 @@ from rq_scheduler import Scheduler
|
||||||
from sqlalchemy import create_engine
|
from sqlalchemy import create_engine
|
||||||
from sqlalchemy.orm import sessionmaker
|
from sqlalchemy.orm import sessionmaker
|
||||||
from flask import Flask, render_template, request, redirect, session, abort, url_for
|
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,
|
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,
|
get_templates, get_allowed_users, add_ignored_pool, delete_ignored_pool, add_allowed_user,
|
||||||
delete_allowed_user,
|
delete_allowed_user,
|
||||||
|
@ -39,7 +43,12 @@ else:
|
||||||
app.config.from_pyfile(config)
|
app.config.from_pyfile(config)
|
||||||
app.config['GIT_REVISION'] = subprocess.check_output(
|
app.config['GIT_REVISION'] = subprocess.check_output(
|
||||||
['git', 'rev-parse', '--short', 'HEAD']).decode('utf-8').rstrip()
|
['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:
|
with open('proxmox_ssh_key', 'w') as ssh_key_file:
|
||||||
ssh_key_file.write(app.config['PROXMOX_SSH_KEY'])
|
ssh_key_file.write(app.config['PROXMOX_SSH_KEY'])
|
||||||
|
|
||||||
|
|
|
@ -19,3 +19,4 @@ tenacity==5.0.2
|
||||||
websockify==0.8.0
|
websockify==0.8.0
|
||||||
pylint==2.3.1
|
pylint==2.3.1
|
||||||
pylint-quotes==0.2.1
|
pylint-quotes==0.2.1
|
||||||
|
sentry-sdk~=0.13.1
|
||||||
|
|
Loading…
Reference in a new issue