Enable local browser error reporting if ZILENCER_ENABLED.

This commit is contained in:
Tim Abbott 2016-08-11 12:44:09 -07:00
parent ba7ef1c82d
commit 95aee366c8
2 changed files with 11 additions and 5 deletions

View File

@ -275,9 +275,11 @@ class ErrorReporter(QueueProcessingWorker):
def consume(self, event):
# type: (Mapping[str, Any]) -> None
if not settings.DEPLOYMENT_ROLE_KEY:
return
if settings.DEPLOYMENT_ROLE_KEY:
self.staging_client.forward_error(event['type'], event['report'])
elif settings.ZILENCER_ENABLED:
from zilencer.views import do_report_error
do_report_error(settings.DEPLOYMENT_ROLE_NAME, event['type'], event['report'])
@assign_queue('slow_queries')
class SlowQueryWorker(QueueProcessingWorker):

View File

@ -84,8 +84,12 @@ def submit_feedback(request, deployment, message=REQ(validator=check_dict([]))):
@has_request_variables
def report_error(request, deployment, type=REQ(), report=REQ(validator=check_dict([]))):
# type: (HttpRequest, Deployment, str, Dict[str, Any]) -> HttpResponse
report['deployment'] = deployment.name
# type: (HttpRequest, Deployment, text_type, Dict[str, Any]) -> HttpResponse
return do_report_error(deployment.name, type, report)
def do_report_error(deployment_name, type, report):
# type: (text_type, text_type, Dict[str, Any]) -> HttpResponse
report['deployment'] = deployment_name
if type == 'browser':
notify_browser_error(report)
elif type == 'server':