Sha256: 32a5406b9c45546b247ebb20207c22900542afcad98ded0d93d5db9104fb49e5

Contents?: true

Size: 1.18 KB

Versions: 5

Compression:

Stored size: 1.18 KB

Contents

$: << File.join(File.absolute_path(__FILE__), '..', 'lib')

require "pulse-meter"
            
PulseMeter.redis = Redis.new

cfg = PulseMeter::Sensor::Configuration.new(
  lama_count: {
    sensor_type:'timelined/counter',
    args: {
      annotation: 'Lama Count',
      interval: 10,
      ttl: 3600
    }
  },

  lama_average_age: {
    sensor_type:'timelined/average',
    args: {
      annotation: 'Lama Average Age',
      interval: 20,
      ttl: 3600
    }
  },

  rhino_count: {
    sensor_type:'timelined/counter',
    args: {
      annotation: 'Rhino Count',
      interval: 10,
      ttl: 3600
    }
  },

  goose_count: {
    sensor_type:'timelined/hashed_counter',
    args: {
      annotation: 'Goose Count',
      interval: 10,
      ttl: 3600
    }
  },

  rhino_average_age: {
    sensor_type:'timelined/average',
    args: {
      annotation: 'Rhino average age',
      interval: 20,
      ttl: 3600
    }
  }
)

while true
  sleep(Random.rand)
  STDERR.puts "tick"
  cfg.lama_count(1)
  cfg.rhino_count(2)
  cfg.lama_average_age(Random.rand(50))
  cfg.rhino_average_age(Random.rand(100))

  10.times do
    goose_n = Random.rand(4)
    cfg.goose_count("goose_#{goose_n}" => 1)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pulse-meter-0.2.1 examples/basic_sensor_data.rb
pulse-meter-0.2.0 examples/basic_sensor_data.rb
pulse-meter-0.1.11 examples/basic_sensor_data.rb
pulse-meter-0.1.10 examples/basic_sensor_data.rb
pulse-meter-0.1.9 examples/basic_sensor_data.rb