A new Meter
Counters can be incremented and decremented only by 1 at a time..
# File lib/cabin/metrics/meter.rb, line 12 def initialize @inspectables = [ :@value ] @value = 0 @lock = Mutex.new end
Mark an event
# File lib/cabin/metrics/meter.rb, line 19 def mark @lock.synchronize do @value += 1 # TODO(sissel): Keep some moving averages? end emit end
# File lib/cabin/metrics/meter.rb, line 34 def to_hash return @lock.synchronize do { :value => @value } end end
Get the value of this metric.
# File lib/cabin/metrics/meter.rb, line 29 def value return @lock.synchronize { @value } end