synapse/http/server.py
def wrap_request_handler_with_logging(h):
    """Wraps a request handler to provide logging and metrics

    The handler method must have a signature of "handle_foo(self, request)",
    where "self" must have a "clock" attribute (and "request" must be a
    SynapseRequest).

    As well as calling `request.processing` (which will log the response and
    duration for this request), the wrapped request handler will insert the
    request id into the logging context.
    """
    @defer.inlineCallbacks
    def wrapped_request_handler(self, request):
        """
        Args:
            self:
            request (synapse.http.site.SynapseRequest):
        """

        request_id = request.get_request_id()
        with LoggingContext(request_id) as request_context:
            request_context.request = request_id
            with Measure(self.clock, "wrapped_request_handler"):
                # we start the request metrics timer here with an initial stab
                # at the servlet name. For most requests that name will be
                # JsonResource (or a subclass), and JsonResource._async_render
                # will update it once it picks a servlet.
                servlet_name = self.__class__.__name__
                with request.processing(servlet_name):
                    with PreserveLoggingContext(request_context):
                        d = h(self, request)

                        # record the arrival of the request *after*
                        # dispatching to the handler, so that the handler
                        # can update the servlet name in the request
                        # metrics
                        requests_counter.inc(request.method,
                                             request.request_metrics.name)
                        yield d
    return wrapped_request_handler
Wraps a request handler to provide logging and metrics

    The handler method must have a signature of "handle_foo(self, request)",
    where "self" must have a "clock" attribute (and "request" must be a
    SynapseRequest).

    As well as calling `request.processing` (which will log the response and
    duration for this request), the wrapped request handler will insert the
    request id into the logging context.
    


As well as calling `request.processing` (which will log the response and
duration for this request), the wrapped request handler will insert the
request id into the logging context.
As well as calling ` request . processing ` ( which will log the response and duration for this request ) the wrapped request handler will insert the request id into the logging context .
def wrap_request_handler_with_logging(h):
    @defer.inlineCallbacks
    def wrapped_request_handler(self, request):
        request_id = request.get_request_id()
        with LoggingContext(request_id) as request_context:
            request_context.request = request_id
            with Measure(self.clock, "wrapped_request_handler"):
                servlet_name = self.__class__.__name__
                with request.processing(servlet_name):
                    with PreserveLoggingContext(request_context):
                        d = h(self, request)
                        requests_counter.inc(request.method,
                                             request.request_metrics.name)
                        yield d
    return wrapped_request_handler
def wrap_request_handler_with_logging ( h ) : @ defer . inlineCallbacks def wrapped_request_handler ( self , request ) : """
        Args:
            self:
            request (synapse.http.site.SynapseRequest):
        """ request_id = request . get_request_id ( ) with LoggingContext ( request_id ) as request_context : request_context . request = request_id with Measure ( self . clock , "wrapped_request_handler" ) : servlet_name = self . __class__ . __name__ with request . processing ( servlet_name ) : with PreserveLoggingContext ( request_context ) : d = h ( self , request ) requests_counter . inc ( request . method , request . request_metrics . name ) yield d return wrapped_request_handler
Wraps a request handler to provide logging and metrics
The handler method must have a signature of "handle_foo(self, request)",
where "self" must have a "clock" attribute (and "request" must be a
SynapseRequest).
Wraps a request handler to provide logging and metrics The handler method must have a signature of " handle_foo ( self request ) " where " self " must have a " clock " attribute ( and " request " must be a SynapseRequest ) .
"""Wraps a request handler to provide logging and metrics

    The handler method must have a signature of "handle_foo(self, request)",
    where "self" must have a "clock" attribute (and "request" must be a
    SynapseRequest).

    As well as calling `request.processing` (which will log the response and
    duration for this request), the wrapped request handler will insert the
    request id into the logging context.
    """ """
        Args:
            self:
            request (synapse.http.site.SynapseRequest):
        """ # we start the request metrics timer here with an initial stab # at the servlet name. For most requests that name will be # JsonResource (or a subclass), and JsonResource._async_render # will update it once it picks a servlet. # record the arrival of the request *after* # dispatching to the handler, so that the handler # can update the servlet name in the request # metrics
h