Class: MetricCollect::Backend::Graphite

Inherits:
Object
  • Object
show all
Defined in:
lib/backend/graphite.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Graphite



23
24
25
26
27
28
# File 'lib/backend/graphite.rb', line 23

def initialize(name)
  @params = Hash.new
  @params[:name] = name
  @params[:value] = nil
  @params[:key] = "metric_collect"
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_symbol, *args, &block) ⇒ Object



30
31
32
# File 'lib/backend/graphite.rb', line 30

def method_missing(method_symbol, *args, &block)
  @params[method_symbol]
end

Instance Attribute Details

#paramsObject

Returns the value of attribute params.



34
35
36
# File 'lib/backend/graphite.rb', line 34

def params
  @params
end

Instance Method Details

#process_metric(config) ⇒ Object



36
37
38
39
40
41
42
43
# File 'lib/backend/graphite.rb', line 36

def process_metric(config)
  @config = config.params
  name = @params[:name]
  value = @params[:value]
  key = @params[:key]

  report("#{key}.#{name}", value)
end