Class: Nightfury::Metric::AvgTimeSeries

Inherits:
TimeSeries show all
Defined in:
lib/nightfury/metric/avg_time_series.rb

Constant Summary

Constants inherited from Base

Base::ALLOWED_STEPS

Instance Attribute Summary

Attributes inherited from Base

#name, #redis, #redis_key_prefix, #step, #store_as

Instance Method Summary collapse

Methods inherited from TimeSeries

#default_meta, #each_timestamp, floor_time, #floor_time, #get, #get_all, #get_exact, #get_range, #get_step_time, #initialize, #meta, #meta=, seconds_in_step, #seconds_in_step, #set

Methods inherited from Base

#delete, #initialize, #redis_key

Constructor Details

This class inherits a constructor from Nightfury::Metric::TimeSeries

Instance Method Details

#get_padded_range(start_time, end_time) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/nightfury/metric/avg_time_series.rb', line 4

def get_padded_range(start_time, end_time)
  data_points = get_range(start_time, end_time)
  each_timestamp(start_time, end_time) do |current_step_time, last_step_time|
    current_step_time = current_step_time.to_s
    last_step_time = last_step_time.to_s
    next if data_points[current_step_time]
    data_points[current_step_time] = '0.0'
  end
  Hash[data_points.sort]
end