1
Fork 0

Add sentry support

This commit is contained in:
Jake Howard 2018-10-28 11:20:53 +00:00
parent 88122fee90
commit dbb12c2192
Signed by: jake
GPG key ID: 57AFB45680EDD477
4 changed files with 44 additions and 4 deletions

View file

@ -7,6 +7,7 @@ name = "pypi"
flask = "*" flask = "*"
github-webhook = "*" github-webhook = "*"
waitress = "*" waitress = "*"
sentry-sdk = {extras = ["flask"], version = "*"}
[dev-packages] [dev-packages]
black = "*" black = "*"

40
Pipfile.lock generated
View file

@ -1,7 +1,7 @@
{ {
"_meta": { "_meta": {
"hash": { "hash": {
"sha256": "87415b65be9abd963650b4ec4d7629d9b3798b85b1b1f815b7814d0777c5c759" "sha256": "58c4cc1fbede1ecde2fdcb0ab61f0fc0e69181d19efded93bc76229f761814ac"
}, },
"pipfile-spec": 6, "pipfile-spec": 6,
"requires": { "requires": {
@ -16,6 +16,20 @@
] ]
}, },
"default": { "default": {
"blinker": {
"hashes": [
"sha256:471aee25f3992bd325afa3772f1063dbdbbca947a041b8b89466dc00d606f8b6"
],
"markers": "extra == 'flask'",
"version": "==1.4"
},
"certifi": {
"hashes": [
"sha256:339dc09518b07e2fa7eda5450740925974815557727d6bd35d319c1524a04a4c",
"sha256:6d58c986d22b038c8c0df30d639f23a3e6d172a05c3583e766f4c0b785c0986a"
],
"version": "==2018.10.15"
},
"click": { "click": {
"hashes": [ "hashes": [
"sha256:2335065e6395b9e67ca716de5f7526736bfa6ceead690adf616d925bdc622b13", "sha256:2335065e6395b9e67ca716de5f7526736bfa6ceead690adf616d925bdc622b13",
@ -41,10 +55,10 @@
}, },
"itsdangerous": { "itsdangerous": {
"hashes": [ "hashes": [
"sha256:a7de3201740a857380421ef286166134e10fe58846bcefbc9d6424a69a0b99ec", "sha256:321b033d07f2a4136d3ec762eac9f16a10ccd60f53c0c91af90217ace7ba1f19",
"sha256:aca4fc561b7671115a2156f625f2eaa5e0e3527e0adf2870340e7968c0a81f85" "sha256:b12271b2047cb23eeb98c8b5622e2e5c5e9abd9784a153e9d8ef9cb4dd09d749"
], ],
"version": "==1.0.0" "version": "==1.1.0"
}, },
"jinja2": { "jinja2": {
"hashes": [ "hashes": [
@ -59,6 +73,17 @@
], ],
"version": "==1.0" "version": "==1.0"
}, },
"sentry-sdk": {
"extras": [
"flask"
],
"hashes": [
"sha256:9161ccee9cc714ca205d42e252eddbc9ed89152bf09cac099143835486f5e7a4",
"sha256:c18552010648e6303b557310dc6e4babda3c942c6e4145995699547c64d3982f"
],
"index": "pypi",
"version": "==0.5.1"
},
"six": { "six": {
"hashes": [ "hashes": [
"sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9", "sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9",
@ -66,6 +91,13 @@
], ],
"version": "==1.11.0" "version": "==1.11.0"
}, },
"urllib3": {
"hashes": [
"sha256:41c3db2fc01e5b907288010dec72f9d0a74e37d6994e6eb56849f59fea2265ae",
"sha256:8819bba37a02d143296a4d032373c4dd4aca11f6d4c9973335ca75f9c8475f59"
],
"version": "==1.24"
},
"waitress": { "waitress": {
"hashes": [ "hashes": [
"sha256:40b0f297a7f3af61fbfbdc67e59090c70dc150a1601c39ecc9f5f1d283fb931b", "sha256:40b0f297a7f3af61fbfbdc67e59090c70dc150a1601c39ecc9f5f1d283fb931b",

View file

@ -1,3 +1,5 @@
import os import os
GITHUB_WEBHOOK_SECRET = os.environ.get("GITHUB_WEBHOOK_SECRET") GITHUB_WEBHOOK_SECRET = os.environ.get("GITHUB_WEBHOOK_SECRET")
SENTRY_DSN = os.environ.get("SENTRY_DSN")

View file

@ -1,13 +1,18 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import logging import logging
import sentry_sdk
from flask import Flask, abort, jsonify from flask import Flask, abort, jsonify
from github_webhook import Webhook from github_webhook import Webhook
from sentry_sdk.integrations.flask import FlaskIntegration
from . import config from . import config
logging.basicConfig(level=logging.INFO) logging.basicConfig(level=logging.INFO)
if config.SENTRY_DSN:
sentry_sdk.init(dsn=config, integrations=[FlaskIntegration()])
app = Flask(__name__) app = Flask(__name__)
webhook = Webhook(app, secret=config.GITHUB_WEBHOOK_SECRET) webhook = Webhook(app, secret=config.GITHUB_WEBHOOK_SECRET)