From 18a7c47db630e605e01ffcd8d400fa4fd3bc73aa Mon Sep 17 00:00:00 2001 From: Nyo Date: Wed, 28 Dec 2016 12:41:24 +0100 Subject: [PATCH] .BANCHO. Add tornado-sentry capture decorators --- common | 2 +- handlers/apiFokabotMessageHandler.py | 8 +++++++- handlers/apiIsOnlineHandler.py | 7 +++++++ handlers/apiOnlineUsersHandler.py | 7 +++++++ handlers/apiServerStatusHandler.py | 7 +++++++ handlers/apiVerifiedStatusHandler.py | 7 +++++++ handlers/ciTriggerHandler.py | 7 +++++++ handlers/mainHandler.pyx | 9 ++------- 8 files changed, 45 insertions(+), 9 deletions(-) diff --git a/common b/common index 741dde1..6329b9a 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 741dde1ace3e5615d0e1d98cbeb41e07da7fb02b +Subproject commit 6329b9ac2dac305f90b09bc3fa761ced2b4f03d0 diff --git a/handlers/apiFokabotMessageHandler.py b/handlers/apiFokabotMessageHandler.py index 244e94d..9a5ac95 100644 --- a/handlers/apiFokabotMessageHandler.py +++ b/handlers/apiFokabotMessageHandler.py @@ -1,6 +1,9 @@ import json -from common.log import logUtils as log +import tornado.web +import tornado.gen + +from common.sentry import sentry from common.web import requestsManager from constants import exceptions from helpers import chatHelper @@ -8,6 +11,9 @@ from objects import glob class handler(requestsManager.asyncRequestHandler): + @tornado.web.asynchronous + @tornado.gen.engine + @sentry.captureTornado def asyncGet(self): statusCode = 400 data = {"message": "unknown error"} diff --git a/handlers/apiIsOnlineHandler.py b/handlers/apiIsOnlineHandler.py index d6ce1cf..8fb6758 100644 --- a/handlers/apiIsOnlineHandler.py +++ b/handlers/apiIsOnlineHandler.py @@ -1,5 +1,9 @@ import json +import tornado.web +import tornado.gen + +from common.sentry import sentry from common.ripple import userUtils from common.web import requestsManager from constants import exceptions @@ -7,6 +11,9 @@ from objects import glob class handler(requestsManager.asyncRequestHandler): + @tornado.web.asynchronous + @tornado.gen.engine + @sentry.captureTornado def asyncGet(self): statusCode = 400 data = {"message": "unknown error"} diff --git a/handlers/apiOnlineUsersHandler.py b/handlers/apiOnlineUsersHandler.py index 209c59d..4960c8b 100644 --- a/handlers/apiOnlineUsersHandler.py +++ b/handlers/apiOnlineUsersHandler.py @@ -1,10 +1,17 @@ import json +import tornado.web +import tornado.gen + +from common.sentry import sentry from common.web import requestsManager from objects import glob class handler(requestsManager.asyncRequestHandler): + @tornado.web.asynchronous + @tornado.gen.engine + @sentry.captureTornado def asyncGet(self): statusCode = 400 data = {"message": "unknown error"} diff --git a/handlers/apiServerStatusHandler.py b/handlers/apiServerStatusHandler.py index 1f8a021..4a1e6aa 100644 --- a/handlers/apiServerStatusHandler.py +++ b/handlers/apiServerStatusHandler.py @@ -1,10 +1,17 @@ import json +import tornado.web +import tornado.gen + +from common.sentry import sentry from common.web import requestsManager from objects import glob class handler(requestsManager.asyncRequestHandler): + @tornado.web.asynchronous + @tornado.gen.engine + @sentry.captureTornado def asyncGet(self): statusCode = 400 data = {"message": "unknown error"} diff --git a/handlers/apiVerifiedStatusHandler.py b/handlers/apiVerifiedStatusHandler.py index a68aaf4..b4775db 100644 --- a/handlers/apiVerifiedStatusHandler.py +++ b/handlers/apiVerifiedStatusHandler.py @@ -1,11 +1,18 @@ import json +import tornado.web +import tornado.gen + +from common.sentry import sentry from common.web import requestsManager from constants import exceptions from objects import glob class handler(requestsManager.asyncRequestHandler): + @tornado.web.asynchronous + @tornado.gen.engine + @sentry.captureTornado def asyncGet(self): statusCode = 400 data = {"message": "unknown error"} diff --git a/handlers/ciTriggerHandler.py b/handlers/ciTriggerHandler.py index a866afa..5f412e3 100644 --- a/handlers/ciTriggerHandler.py +++ b/handlers/ciTriggerHandler.py @@ -1,5 +1,9 @@ import json +import tornado.web +import tornado.gen + +from common.sentry import sentry from common.log import logUtils as log from common.web import requestsManager from constants import exceptions @@ -8,6 +12,9 @@ from objects import glob class handler(requestsManager.asyncRequestHandler): + @tornado.web.asynchronous + @tornado.gen.engine + @sentry.captureTornado def asyncGet(self): statusCode = 400 data = {"message": "unknown error"} diff --git a/handlers/mainHandler.pyx b/handlers/mainHandler.pyx index 5e624a7..e3cf03b 100644 --- a/handlers/mainHandler.pyx +++ b/handlers/mainHandler.pyx @@ -56,13 +56,14 @@ from events import tournamentJoinMatchChannelEvent from events import tournamentLeaveMatchChannelEvent from helpers import packetHelper from objects import glob +from common.sentry import sentry class handler(requestsManager.asyncRequestHandler): @tornado.web.asynchronous @tornado.gen.engine + @sentry.captureTornado def asyncPost(self): - #try: # Track time if needed if glob.outputRequestTime: # Start time @@ -238,12 +239,6 @@ class handler(requestsManager.asyncRequestHandler): self.add_header("Connection", "keep-alive") self.add_header("Keep-Alive", "timeout=5, max=100") self.add_header("Content-Type", "text/html; charset=UTF-8") - #except: - # log.error("Unknown error!\n```\n{}\n{}```".format(sys.exc_info(), traceback.format_exc())) - # if glob.sentry: - # yield tornado.gen.Task(self.captureException, exc_info=True) - #finally: - # self.finish() @tornado.web.asynchronous @tornado.gen.engine