response._caller is a function that wraps all controller actions, so 
something like this might work:

def statsd(f):
    blah.start()
    result = f()
    blah.stop()
    return result

response._caller = statsd

Anthony

On Wednesday, December 16, 2015 at 2:49:25 PM UTC-5, Octavian G wrote:
>
> Hello,
>
>      I'd like to use statsd with my app. I'd like to time the execution of 
> a web2py function and various smaller pieces of code. The statsd doc (
> http://statsd.readthedocs.org/en/v3.2.1/reference.html#timer) says their 
> timer decorators are not threadsafe. This means I have to run a bla.start() 
> before the function and a bla.stop() after it.
>
>      So my questions are:
>
> 1. Are there any hooks for this ?
> 2. Are there any db query hooks for before and after the execution ?
> 3. Alternatively, what would be a proper way to time code execution in 
> web2py ?
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to