Commit 06ec6e8e authored by Paul Asmuth's avatar Paul Asmuth
Browse files

added :scale_by option for gauges

parent 322d1356
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -53,11 +53,17 @@ module FnordMetric::GaugeCalculations
    #block = @@count_per_session_proc if unique?
    block = @@avg_per_session_proc if unique? && average?

    if block
    calc = if block
      instance_exec(_v, _t, &block)
    else
      _v
    end

    if calc && @opts[:scale_by]
      calc = calc.to_f * @opts[:scale_by].to_f
    end

    calc
  end

  def field_values_at(time, opts={}, &block)