Sha256: 183edb35ab2af084906b59acd9a566973b520bf70365f8ba7d9115f5e526568a

Contents?: true

Size: 1004 Bytes

Versions: 13

Compression:

Stored size: 1004 Bytes

Contents

class Scout::Realtime::Metric
  attr_accessor :historical_metrics
  attr_reader :latest_run

  def initialize
    @historical_metrics = Hash.new
  end

  def run!
    begin
      @latest_run = @collector.run
    rescue Errno::ENOENT => e
      print "#############################################################################"
      puts "#{e.class}: #{e.message}"
      @latest_run = {}
    end
    update_historical_metrics(latest_run)
  end

  def self.metadata
    meta = self::FIELDS
    meta.keys.each_with_object(meta) do |field_name, formatted_meta|
      formatted_meta[field_name]['label'] ||= field_name.to_s.capitalize.gsub('_', ' ')
      formatted_meta[field_name]['units'] ||= ''
      formatted_meta[field_name]['precision'] ||= 1 
    end
  end

  def self.short_name
    self.to_s.split('::').last.downcase.to_sym
  end

  def self.descendants
    [Scout::Realtime::Memory, Scout::Realtime::Cpu, Scout::Realtime::Disk, Scout::Realtime::Network, Scout::Realtime::Processes]
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
scout_realtime-1.0.5 lib/scout_realtime/lib/metric.rb
scout_realtime-1.0.4 lib/scout_realtime/lib/metric.rb
scout_realtime-1.0.3 lib/scout_realtime/lib/metric.rb
scout_realtime-1.0.3.pre lib/scout_realtime/lib/metric.rb
scout_realtime-1.0.2 lib/scout_realtime/lib/metric.rb
scout_realtime-1.0.1 lib/scout_realtime/lib/metric.rb
scout_realtime-1.0.0 lib/scout_realtime/lib/metric.rb
scout_realtime-0.5.5 lib/scout_realtime/lib/metric.rb
scout_realtime-0.5.5.pre lib/scout_realtime/lib/metric.rb
scout_realtime-0.5.4 lib/scout_realtime/lib/metric.rb
scout_realtime-0.5.3 lib/scout_realtime/lib/metric.rb
scout_realtime-0.5.2 lib/scout_realtime/lib/metric.rb
scout_realtime-0.5.1 lib/scout_realtime/lib/metric.rb