The point is to write a Fnordmetric helper. Fnordmetric is a "statsd-like" metric collector without the Carbon hassle.
- I would like to be able to do things like :
push_timer :hell_yeah
# do some code
pop_timer
=> pop_timer pops the last timer pushed and sends an event to Fnormetric with the id hell_yeah. Thus, timers can be nested :
push_timer :hell_yeah
# do some code
push_timer :some_nested_timer
# some more code
pop_timer
pop_timer
=> this will send two events (:some_nested_timer first, then :hell_yeah)
- Other uses could be :
times(:some_id) do
# some code block
end
=> this uses {push,pop}_timer behind the scenes
- Also, another style :
class Users < Controller
helper ::fnordmetric
clock :login
=> this measure the login method execution time, by wrapping it automatically between push_timer/pop_timer calls
- Another usage, implemented in before/after blocks, to measuse several methods :
before_all do |m|
push_timer :performance, :this => "some args", :method => m
end
after_all do |m|
pop_timer
end
I basically tryied implementing all of this, and it always break when redirect* is called.