Use top level measure
This commit is contained in:
parent
27e0178da9
commit
a093fab253
|
@ -222,7 +222,7 @@ class JsonResource(HttpServer, resource.Resource):
|
||||||
# It does its own metric reporting because _async_render dispatches to
|
# It does its own metric reporting because _async_render dispatches to
|
||||||
# a callback and it's the class name of that callback we want to report
|
# a callback and it's the class name of that callback we want to report
|
||||||
# against rather than the JsonResource itself.
|
# against rather than the JsonResource itself.
|
||||||
@request_handler(report_metrics=False)
|
@request_handler()
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def _async_render(self, request):
|
def _async_render(self, request):
|
||||||
""" This gets called from render() every time someone sends us a request.
|
""" This gets called from render() every time someone sends us a request.
|
||||||
|
@ -233,9 +233,6 @@ class JsonResource(HttpServer, resource.Resource):
|
||||||
self._send_response(request, 200, {})
|
self._send_response(request, 200, {})
|
||||||
return
|
return
|
||||||
|
|
||||||
request_metrics = RequestMetrics()
|
|
||||||
request_metrics.start(self.clock)
|
|
||||||
|
|
||||||
# Loop through all the registered callbacks to check if the method
|
# Loop through all the registered callbacks to check if the method
|
||||||
# and path regex match
|
# and path regex match
|
||||||
for path_entry in self.path_regexs.get(request.method, []):
|
for path_entry in self.path_regexs.get(request.method, []):
|
||||||
|
@ -249,12 +246,6 @@ class JsonResource(HttpServer, resource.Resource):
|
||||||
|
|
||||||
callback = path_entry.callback
|
callback = path_entry.callback
|
||||||
|
|
||||||
servlet_instance = getattr(callback, "__self__", None)
|
|
||||||
if servlet_instance is not None:
|
|
||||||
servlet_classname = servlet_instance.__class__.__name__
|
|
||||||
else:
|
|
||||||
servlet_classname = "%r" % callback
|
|
||||||
|
|
||||||
kwargs = intern_dict({
|
kwargs = intern_dict({
|
||||||
name: urllib.unquote(value).decode("UTF-8") if value else value
|
name: urllib.unquote(value).decode("UTF-8") if value else value
|
||||||
for name, value in m.groupdict().items()
|
for name, value in m.groupdict().items()
|
||||||
|
@ -265,11 +256,6 @@ class JsonResource(HttpServer, resource.Resource):
|
||||||
code, response = callback_return
|
code, response = callback_return
|
||||||
self._send_response(request, code, response)
|
self._send_response(request, code, response)
|
||||||
|
|
||||||
try:
|
|
||||||
request_metrics.stop(self.clock, request, servlet_classname)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# Huh. No one wanted to handle that? Fiiiiiine. Send 400.
|
# Huh. No one wanted to handle that? Fiiiiiine. Send 400.
|
||||||
|
|
Loading…
Reference in New Issue