class Fluent::StatsitePlugin::Histogram
Constants
- FIELD
- FLOATING_FIELD
- OPTIONAL_FIELD
Public Class Methods
new(prefix, min, max, width)
click to toggle source
# File lib/fluent/plugin/statsite/histogram.rb, line 18 def initialize(prefix, min, max, width) @prefix = prefix @min = min @max = max @width = width @section = prefix.nil? ? "default" : prefix end
validate(h)
click to toggle source
# File lib/fluent/plugin/statsite/histogram.rb, line 37 def self.validate(h) if h.class != Hash raise ConfigError, "a type of histogram element must be Hash, but specified as #{h.class}" end FIELD.each do |f| if not h.has_key?(f) raise ConfigError, "histogram element must contain '#{f}'" end end h.keys.each do |k| if not FIELD.member?(k) and not OPTIONAL_FIELD.member?(k) raise ConfigError, "invalid histogram hash key: #{k}" end end FLOATING_FIELD.each do |f| cls = h[f].class if cls != Fixnum and cls != Float raise ConfigError, "#{f} value of histogram must be Fixnum or Float" end end new(h['prefix'], h['min'], h['max'], h['width']) end
Public Instance Methods
to_ini()
click to toggle source
# File lib/fluent/plugin/statsite/histogram.rb, line 27 def to_ini <<-INI [histogram_#{@section}] prefix=#{@prefix} min=#{@min} max=#{@max} width=#{@width} INI end