Statsd Timer Object
Additional documentation is available at the parent class Client
>>> timer = Timer('application_name')
>>> timer.start()
>>> # do something
>>> timer.stop('executed_action')
Decorate a function to time the execution
The method can be called with or without a name. If no name is given the function defaults to the name of the function.
Parameters: | function_or_name – The name to post to or the function to wrap |
---|
>>> from statsd import Timer
>>> timer = Timer('application_name')
>>>
>>> @timer.decorate
... def some_function():
... # resulting timer name: application_name.some_function
... pass
>>>
>>> @timer.decorate('my_timer')
... def some_function():
... # resulting timer name: application_name.my_timer
... pass
Send the time that has passed since our last measurement
Parameters: | subname – The subname to report the data to (appended to the client name) |
---|
Send the data to statsd via self.connection
Parameters: |
|
---|
Start the timer and store the start time, this can only be executed once per instance
Stop the timer and send the total since start() was run
Parameters: | subname – The subname to report the data to (appended to the client name) |
---|