lib/spectator/gauge.rb in netflix-spectator-rb-0.2.2 vs lib/spectator/gauge.rb in netflix-spectator-rb-0.3.0
- old
+ new
@@ -1,9 +1,9 @@
# frozen_string_literal: true
-require 'spectator/atomic_number'
-require 'spectator/measure'
+require_relative 'atomic_number'
+require_relative 'measure'
module Spectator
# A meter with a single value that can only be sampled at a point in time.
# A typical example is a queue size.
class Gauge
@@ -23,10 +23,11 @@
@value.set(value)
end
# Get the current value, and reset it
def measure
- [Measure.new(@id.with_stat('gauge'), @value.get_and_set(Float::NAN))]
+ [Measure.new(@id.with_default_stat('gauge'),
+ @value.get_and_set(Float::NAN))]
end
# A string representation of this gauge, useful for debugging purposes
def to_s
"Gauge{id=#{@id}, value=#{@value.get}}"