supercell.stats.
latency
(fn)¶Measure execution latency of a certain request method.
In order to measure latency for GET requests of a request handler you
simply have to add the latency()
decorator to the declaration:
@s.latency
@s.async
def get(self, *args, **kwargs):
...
The latency is recorded along the request path, i.e. if the request handler is defined like this:
env.add_handler('/test/this', LatencyExample)
the latency of GET/POST/PUT etc methods are stored with the path. In order to access the stats you may call /_system/stats/test/this or /_system/stats/test, e.g.
supercell.stats.
metered
(fn)¶Meter the execution of certain requests.
The metered()
stats will measure the 1/5/15 minutes averages for
requests. This is also applied trivially:
@s.metered
@s.async
def get(self, *args, **kwargs):
...
As with the latency()
stats, the metered()
stats are recorded
along the request path, i.e. you can get the stats values using the
/_system/stats/ route.