lib/fnordmetric/gauge_calculations.rb in fnordmetric-1.0.1 vs lib/fnordmetric/gauge_calculations.rb in fnordmetric-1.2.0

- old
+ new

@@ -50,15 +50,21 @@ def calculate_value(_v, _t, opts, block) block = @@avg_per_count_proc if average? #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) opts[:max_fields] ||= 50 field_values = sync_redis.zrevrange(