Method: Hallmonitor::Monitored#watch
- Defined in:
- lib/hallmonitor/monitored.rb
#watch(name, tags: {}) {|event| ... } ⇒ Object
Note:
Will emit the timed event even if the block raises an error
Executes and times a block of code and emits a TimedEvent
90 91 92 93 94 95 96 97 98 99 |
# File 'lib/hallmonitor/monitored.rb', line 90 def watch(name, tags: {}) event = Hallmonitor::TimedEvent.new(name, tags: ) event.start = Time.now begin yield(event) ensure event.stop = Time.now emit(event) end end |