def on_finish(self):
        """Invoked once the request has been finished. Increments a counter
        created in the format:

        .. code::

            <PREFIX>.counters.<host>.package[.module].Class.METHOD.STATUS
            sprockets.counters.localhost.tornado.web.RequestHandler.GET.200

        Adds a value to a timer in the following format:

        .. code::

            <PREFIX>.timers.<host>.package[.module].Class.METHOD.STATUS
            sprockets.timers.localhost.tornado.web.RequestHandler.GET.200

        """
        if self.statsd_prefix != statsd.STATSD_PREFIX:
            statsd.set_prefix(self.statsd_prefix)

        if hasattr(self, 'request') and self.request:
            if self.statsd_use_hostname:
                timer_prefix = 'timers.{0}'.format(socket.gethostname())
                counter_prefix = 'counters.{0}'.format(socket.gethostname())
            else:
                timer_prefix = 'timers'
                counter_prefix = 'counters'

            statsd.add_timing(timer_prefix,
                              self.__module__,
                              str(self.__class__.__name__),
                              self.request.method,
                              str(self._status_code),
                              value=self.request.request_time() * 1000)

            statsd.incr(counter_prefix,
                        self.__module__,
                        self.__class__.__name__,
                        self.request.method,
                        str(self._status_code))

        super(RequestMetricsMixin, self).on_finish()
def on_finish ( self ) : if self . statsd_prefix != statsd . STATSD_PREFIX : statsd . set_prefix ( self . statsd_prefix ) if hasattr ( self , 'request' ) and self . request : if self . statsd_use_hostname : timer_prefix = 'timers.{0}' . format ( socket . gethostname ( ) ) counter_prefix = 'counters.{0}' . format ( socket . gethostname ( ) ) else : timer_prefix = 'timers' counter_prefix = 'counters' statsd . add_timing ( timer_prefix , self . __module__ , str ( self . __class__ . __name__ ) , self . request . method , str ( self . _status_code ) , value = self . request . request_time ( ) * 1000 ) statsd . incr ( counter_prefix , self . __module__ , self . __class__ . __name__ , self . request . method , str ( self . _status_code ) ) super ( RequestMetricsMixin , self ) . on_finish ( )
Invoked once the request has been finished. Increments a counter
        created in the format:

        .. code::

            <PREFIX>.counters.<host>.package[.module].Class.METHOD.STATUS
            sprockets.counters.localhost.tornado.web.RequestHandler.GET.200

        Adds a value to a timer in the following format:

        .. code::

            <PREFIX>.timers.<host>.package[.module].Class.METHOD.STATUS
            sprockets.timers.localhost.tornado.web.RequestHandler.GET.200