Class: PulseMeter::Sensor::Timelined::HashedIndicator

Inherits:
PulseMeter::Sensor::Timeline show all
Defined in:
lib/pulse_meter/sensor/timelined/hashed_indicator.rb

Overview

Saves last registered values for multiple flags per interval. Good replacement for multiple indicators to be visualized together

Constant Summary

Constants inherited from PulseMeter::Sensor::Timeline

PulseMeter::Sensor::Timeline::DEFAULTS, PulseMeter::Sensor::Timeline::MAX_TIMESPAN_POINTS

Constants included from PulseMeter::Sensor::TimelineReduce

PulseMeter::Sensor::TimelineReduce::MAX_INTERVALS

Constants included from Mixins::Dumper

Mixins::Dumper::DUMP_REDIS_KEY

Instance Attribute Summary

Attributes inherited from PulseMeter::Sensor::Timeline

#interval, #raw_data_ttl, #reduce_delay, #timezone, #ttl

Attributes inherited from Base

#name, #redis

Instance Method Summary collapse

Methods inherited from PulseMeter::Sensor::Timeline

#cleanup, #current_interval_id, #current_raw_data_key, #data_key, #deflate_safe, #drop_within, #event_at, #get_interval_id, #get_raw_value, #initialize, #raw_data_key, #timeline, #timeline_within

Methods included from PulseMeter::Sensor::TimelineReduce

#collect_ids_to_reduce, included, #reduce, #reduce_all_raw

Methods included from Mixins::Utils

#assert_array!, #assert_positive_integer!, #assert_ranged_float!, #camelize, #camelize_keys, #constantize, #each_subset, #parse_time, #subsets_of, #symbolize_keys, #titleize, #underscore, #uniqid

Methods inherited from Base

#annotate, #annotation, #cleanup, #command_aggregator, #event, #initialize

Methods included from Mixins::Dumper

included

Constructor Details

This class inherits a constructor from PulseMeter::Sensor::Timeline

Instance Method Details

#aggregate_event(key, data) ⇒ Object



9
10
11
12
13
# File 'lib/pulse_meter/sensor/timelined/hashed_indicator.rb', line 9

def aggregate_event(key, data)
  data.each_pair do |k, v|
    command_aggregator.hset(key, k, v) if v.respond_to?(:to_f)
  end
end

#summarize(key) ⇒ Object



15
16
17
18
19
20
# File 'lib/pulse_meter/sensor/timelined/hashed_indicator.rb', line 15

def summarize(key)
  redis.
    hgetall(key).
    inject({}) {|h, (k, v)| h[k] = v.to_f; h}.
    to_json
end