From 465b5da18fb19cf4341adefe082ab8dede2fd851 Mon Sep 17 00:00:00 2001 From: animuk Date: Mon, 13 May 2019 17:28:49 +0530 Subject: [PATCH 1/2] Sentry integration into gemini server --- openshift/template.yaml | 11 ++++------- requirements.in | 1 + requirements.txt | 1 + src/rest_api.py | 3 +++ 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/openshift/template.yaml b/openshift/template.yaml index 7d0fb3d..bac2a71 100644 --- a/openshift/template.yaml +++ b/openshift/template.yaml @@ -103,7 +103,10 @@ objects: - name: WORKER_ADMINISTRATION_REGION value: "api" - name: SENTRY_DSN - value: "${SENTRY_DSN}" + valueFrom: + secretKeyRef: + name: worker + key: sentry_dsn - name: BAYESIAN_FETCH_PUBLIC_KEY valueFrom: configMapKeyRef: @@ -232,12 +235,6 @@ parameters: name: GEMINI_API_SERVICE_PORT value: "5000" -- description: Sentry DSN - displayName: Sentry DSN - required: false - name: SENTRY_DSN - value: "" - - description: "Flask logging level (see: https://docs.python.org/3/library/logging.html#levels)" displayName: Flask logging level required: false diff --git a/requirements.in b/requirements.in index d52fc28..a79963e 100644 --- a/requirements.in +++ b/requirements.in @@ -11,3 +11,4 @@ pytest-mock codecov radon boto3 +sentry-sdk diff --git a/requirements.txt b/requirements.txt index 222a62c..d231671 100644 --- a/requirements.txt +++ b/requirements.txt @@ -45,3 +45,4 @@ six==1.11.0 # via flask-cors, mando, more-itertools, pytest, pytho sqlalchemy==1.2.12 urllib3==1.23 # via botocore, requests werkzeug==0.14.1 # via flask +sentry-sdk==0.7.2 diff --git a/src/rest_api.py b/src/rest_api.py index a680345..c03f0a6 100644 --- a/src/rest_api.py +++ b/src/rest_api.py @@ -13,11 +13,14 @@ from repo_dependency_creator import RepoDependencyCreator from notification.user_notification import UserNotification from fabric8a_auth.errors import AuthError +import sentry_sdk app = Flask(__name__) CORS(app) +sentry_sdk.init(os.environ.get("SENTRY_DSN")) + init_selinon() SERVICE_TOKEN = 'token' From ba7add7760f14d302f43cb050feb51eb46ee2771 Mon Sep 17 00:00:00 2001 From: animuk Date: Mon, 13 May 2019 17:40:02 +0530 Subject: [PATCH 2/2] Quick fix --- src/rest_api.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/rest_api.py b/src/rest_api.py index c03f0a6..6decb4e 100644 --- a/src/rest_api.py +++ b/src/rest_api.py @@ -1,4 +1,5 @@ """Definition of the routes for gemini server.""" +import os import flask import requests from flask import Flask, request