forked from MirrorHub/synapse
Move outgoing_responses_counter handling to RequestMetrics
it's much neater there.
This commit is contained in:
parent
b8700dd7d0
commit
49e5a613f1
2 changed files with 2 additions and 4 deletions
|
@ -119,6 +119,8 @@ class RequestMetrics(object):
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
outgoing_responses_counter.inc(request.method, str(request.code))
|
||||||
|
|
||||||
response_count.inc(request.method, self.name, tag)
|
response_count.inc(request.method, self.name, tag)
|
||||||
|
|
||||||
response_timer.inc_by(
|
response_timer.inc_by(
|
||||||
|
|
|
@ -20,7 +20,6 @@ from synapse.api.errors import (
|
||||||
)
|
)
|
||||||
from synapse.http.request_metrics import (
|
from synapse.http.request_metrics import (
|
||||||
requests_counter,
|
requests_counter,
|
||||||
outgoing_responses_counter,
|
|
||||||
)
|
)
|
||||||
from synapse.util.logcontext import LoggingContext, PreserveLoggingContext
|
from synapse.util.logcontext import LoggingContext, PreserveLoggingContext
|
||||||
from synapse.util.caches import intern_dict
|
from synapse.util.caches import intern_dict
|
||||||
|
@ -112,7 +111,6 @@ def wrap_request_handler(request_handler, include_metrics=False):
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
logger.exception(e)
|
logger.exception(e)
|
||||||
outgoing_responses_counter.inc(request.method, str(code))
|
|
||||||
respond_with_json(
|
respond_with_json(
|
||||||
request, code, cs_exception(e), send_cors=True,
|
request, code, cs_exception(e), send_cors=True,
|
||||||
pretty_print=_request_user_agent_is_curl(request),
|
pretty_print=_request_user_agent_is_curl(request),
|
||||||
|
@ -274,8 +272,6 @@ class JsonResource(HttpServer, resource.Resource):
|
||||||
|
|
||||||
def _send_response(self, request, code, response_json_object,
|
def _send_response(self, request, code, response_json_object,
|
||||||
response_code_message=None):
|
response_code_message=None):
|
||||||
outgoing_responses_counter.inc(request.method, str(code))
|
|
||||||
|
|
||||||
# TODO: Only enable CORS for the requests that need it.
|
# TODO: Only enable CORS for the requests that need it.
|
||||||
respond_with_json(
|
respond_with_json(
|
||||||
request, code, response_json_object,
|
request, code, response_json_object,
|
||||||
|
|
Loading…
Reference in a new issue