lib/fozzie/interface.rb in fozzie-0.0.16 vs lib/fozzie/interface.rb in fozzie-0.0.17

- old
+ new

@@ -35,11 +35,10 @@ # Registers the time taken to complete a given block (in ms), with an optional sample rate # # `Stats.time 'wat' { # Do something... }` def time(stat, sample_rate=1) - stat = stat.flatten.join('.') if stat.kind_of?(Array) start = Time.now result = yield timing(stat, ((Time.now - start) * 1000).round, sample_rate) result end @@ -102,20 +101,19 @@ # Registers an increment on the result of the given boolean # # `Stats.increment_on 'wat', wat.random?` def increment_on(stat, perf, sample_rate=1) - key = "#{stat}.%s" % (perf ? "success" : "fail") + key = [stat, (perf ? "success" : "fail")] increment(key, sample_rate) perf end # Register an event of any type # # `Stats.event 'wat', 'app'` def event(type, app = nil) - stat = ["event", type.to_s, app].compact.join('.') - timing stat, Time.now.usec + timing ["event", type.to_s, app], Time.now.usec end end end \ No newline at end of file