Sha256: 8bd1afaa7064de22c91076f16b50019d3fc1aa81182448ee0d652b633b585479

Contents?: true

Size: 1.4 KB

Versions: 2

Compression:

Stored size: 1.4 KB

Contents

require 'pulse-meter/sensor/base'
require 'pulse-meter/sensor/counter'
require 'pulse-meter/sensor/hashed_counter'
require 'pulse-meter/sensor/indicator'
require 'pulse-meter/sensor/timeline'
require 'pulse-meter/sensor/timelined/average'
require 'pulse-meter/sensor/timelined/counter'
require 'pulse-meter/sensor/timelined/hashed_counter'
require 'pulse-meter/sensor/timelined/min'
require 'pulse-meter/sensor/timelined/max'
require 'pulse-meter/sensor/timelined/percentile'
require 'pulse-meter/sensor/timelined/median'

# Top level sensor module
module PulseMeter

  # Atomic sensor data
  SensorData = Struct.new(:start_time, :value)

  # General sensor exception
  class SensorError < StandardError; end

  # Exception to be raised when sensor name is malformed
  class BadSensorName < SensorError
    def initialize(name, options = {})
      super("Bad sensor name: `#{name}', only a-z letters and _ are allowed")
    end
  end

  # Exception to be raised when Redis is not initialized
  class RedisNotInitialized < SensorError
    def initialize
      super("PulseMeter.redis is not set")
    end
  end

  # Exception to be raised when sensor cannot be dumped
  class DumpError < SensorError; end

  # Exception to be raised on attempts of using the same key for different sensors
  class DumpConflictError < DumpError; end

  # Exception to be raised when sensor cannot be restored
  class RestoreError < SensorError; end

end
  

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
pulse-meter-client-backport-0.1.3 lib/pulse-meter/sensor.rb
pulse-meter-0.1.10 lib/pulse-meter/sensor.rb