bin/example.rb in hallmonitor-0.4.0 vs bin/example.rb in hallmonitor-1.0.0

- old
+ new

@@ -1,15 +1,17 @@ +#!/usr/bin/env ruby + lib = File.expand_path('../../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'hallmonitor' require 'hallmonitor/outputters/iooutputter' require 'hallmonitor/outputters/statsd_outputter' require 'pry' -Hallmonitor::Outputter.add_outputter Hallmonitor::Outputters::IOOutputter.new("STDOUT", STDOUT) -Hallmonitor::Outputter.add_outputter Hallmonitor::Outputters::StatsdOutputter.new("example", "graphite.demo.transis.net") +Hallmonitor.add_outputter Hallmonitor::Outputters::IOOutputter.new("STDOUT", STDOUT) +Hallmonitor.add_outputter Hallmonitor::Outputters::StatsdOutputter.new("example", "localhost") class Foo include Hallmonitor::Monitored def do_something @@ -28,11 +30,20 @@ end end def time_me watch("timed") do |x| - sleep(10) + sleep(5) end end end -binding.pry +f = Foo.new + +puts 'Calling method with timer_for and count_for...' +f.do_something + +puts 'Emitting some events' +f.emit_events(5) + +puts 'Timing a 5 second block' +f.time_me