From 634efb1bb30088685d7ae54f3b0963bcd4f076cc Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Sun, 6 Jun 2021 18:44:29 +0530 Subject: added Sentry Support --- Pipfile | 1 + Pipfile.lock | 10 +++++++++- app/__init__.py | 9 +++++++++ requirements.txt | 1 + 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Pipfile b/Pipfile index bd80bfe..8989632 100644 --- a/Pipfile +++ b/Pipfile @@ -21,6 +21,7 @@ uvicorn = "*" gunicorn = "*" requests = "*" flask-mailman = "*" +sentry-sdk = "*" [requires] python_version = "3.8" diff --git a/Pipfile.lock b/Pipfile.lock index 127de50..e6b56cf 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "14808cca3fa886fb738a0f520770ddc3573f561206bfb46ccc1606f4c98221ad" + "sha256": "ab9ecab67b97293cb39ed759a8f5e028f4e82c661d8a93f48d22bbf4fb76a977" }, "pipfile-spec": 6, "requires": { @@ -397,6 +397,14 @@ "index": "pypi", "version": "==2.25.1" }, + "sentry-sdk": { + "hashes": [ + "sha256:c1227d38dca315ba35182373f129c3e2722e8ed999e52584e6aca7d287870739", + "sha256:c7d380a21281e15be3d9f67a3c4fbb4f800c481d88ff8d8931f39486dd7b4ada" + ], + "index": "pypi", + "version": "==1.1.0" + }, "six": { "hashes": [ "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926", diff --git a/app/__init__.py b/app/__init__.py index 72aac8c..fcaddc9 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -1,3 +1,4 @@ +import sentry_sdk import click from flask import Flask from flask_bcrypt import Bcrypt @@ -5,9 +6,17 @@ from flask.cli import AppGroup from flask_sqlalchemy import SQLAlchemy import flask_login from flask_mailman import Mail +from sentry_sdk.integrations.flask import FlaskIntegration +from os import environ from authlib.integrations.flask_client import OAuth +sentry_sdk.init( + dsn=environ.get("SENTRY_DSN"), + integrations=[FlaskIntegration()], + traces_sample_rate=1.0 +) + app = Flask(__name__) app.config.from_object("app.config") diff --git a/requirements.txt b/requirements.txt index c41aed1..b457618 100644 --- a/requirements.txt +++ b/requirements.txt @@ -47,6 +47,7 @@ pytest-codecov==0.3.0 pytest-cov==2.12.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' pytest==6.2.4 requests==2.25.1 +sentry-sdk==1.1.0 six==1.16.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3' sqlalchemy==1.4.17; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5' starlette==0.14.2; python_version >= '3.6' -- cgit v1.2.3