##// END OF EJS Templates
metrics: expose exc_type in consistent format
super-admin -
r4808:e4831d78 default
parent child Browse files
Show More
@@ -179,7 +179,9 b' def exception_view(exc, request):'
179
179
180 statsd = request.registry.statsd
180 statsd = request.registry.statsd
181 if statsd:
181 if statsd:
182 statsd.incr('rhodecode_exception_total', tags=["exc_source:api", "type:{}".format(exc_info.type)])
182 exc_type = "{}.{}".format(exc.__class__.__module__, exc.__class__.__name__)
183 statsd.incr('rhodecode_exception_total',
184 tags=["exc_source:api", "type:{}".format(exc_type)])
183
185
184 return jsonrpc_error(request, fault_message, rpc_id)
186 return jsonrpc_error(request, fault_message, rpc_id)
185
187
@@ -180,11 +180,6 b' def error_handler(exception, request):'
180 log.exception(
180 log.exception(
181 'error occurred handling this request for path: %s', request.path)
181 'error occurred handling this request for path: %s', request.path)
182
182
183 statsd = request.registry.statsd
184 if statsd and base_response.status_code > 499:
185 statsd.incr('rhodecode_exception_total',
186 tags=["exc_source:web", "type:{}".format(base_response.status_code)])
187
188 error_explanation = base_response.explanation or str(base_response)
183 error_explanation = base_response.explanation or str(base_response)
189 if base_response.status_code == 404:
184 if base_response.status_code == 404:
190 error_explanation += " Optionally you don't have permission to access this page."
185 error_explanation += " Optionally you don't have permission to access this page."
@@ -229,6 +224,14 b' def error_handler(exception, request):'
229 '/errors/error_document.mako', {'c': c, 'h': helpers}, request=request,
224 '/errors/error_document.mako', {'c': c, 'h': helpers}, request=request,
230 response=base_response)
225 response=base_response)
231
226
227 statsd = request.registry.statsd
228 if statsd and base_response.status_code > 499:
229 exc_type = "{}.{}".format(exception.__class__.__module__, exception.__class__.__name__)
230 statsd.incr('rhodecode_exception_total',
231 tags=["exc_source:web",
232 "http_code:{}".format(base_response.status_code),
233 "type:{}".format(exc_type)])
234
232 return response
235 return response
233
236
234
237
@@ -179,7 +179,9 b' def task_failure_signal('
179 store_exception(id(exc_info), exc_info, prefix='rhodecode-celery')
179 store_exception(id(exc_info), exc_info, prefix='rhodecode-celery')
180 statsd = StatsdClient.statsd
180 statsd = StatsdClient.statsd
181 if statsd:
181 if statsd:
182 statsd.incr('rhodecode_exception_total', tags=["exc_source:celery", "type:{}".format(einfo.type)])
182 exc_type = "{}.{}".format(einfo.__class__.__module__, einfo.__class__.__name__)
183 statsd.incr('rhodecode_exception_total',
184 tags=["exc_source:celery", "type:{}".format(exc_type)])
183
185
184 closer = celery_app.conf['PYRAMID_CLOSER']
186 closer = celery_app.conf['PYRAMID_CLOSER']
185 if closer:
187 if closer:
@@ -46,6 +46,7 b' class RequestWrapperTween(object):'
46 def __call__(self, request):
46 def __call__(self, request):
47 start = time.time()
47 start = time.time()
48 log.debug('Starting request time measurement')
48 log.debug('Starting request time measurement')
49 response = None
49 try:
50 try:
50 response = self.handler(request)
51 response = self.handler(request)
51 finally:
52 finally:
@@ -64,7 +65,7 b' class RequestWrapperTween(object):'
64 statsd = request.registry.statsd
65 statsd = request.registry.statsd
65 if statsd:
66 if statsd:
66 match_route = request.matched_route.name if request.matched_route else _path
67 match_route = request.matched_route.name if request.matched_route else _path
67 resp_code = response.status_code
68 resp_code = getattr(response, 'status_code', 'UNDEFINED')
68 elapsed_time_ms = round(1000.0 * total) # use ms only
69 elapsed_time_ms = round(1000.0 * total) # use ms only
69 statsd.timing(
70 statsd.timing(
70 "rhodecode_req_timing.histogram", elapsed_time_ms,
71 "rhodecode_req_timing.histogram", elapsed_time_ms,
General Comments 0
You need to be logged in to leave comments. Login now