Class: Ring::SQA::Graphite

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

Constant Summary collapse

ROOT =
"nlnog.ring_sqa.#{CFG.afi}"

Instance Method Summary collapse

Instance Method Details

#add(records) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/ring/sqa/graphite.rb', line 9

def add records
  host = @hostname.split(".").first
  node =  @nodes.all
  records.each do |record|
    nodename = noderec = node[record.peer][:name].split(".").first
    nodecc = noderec = node[record.peer][:cc].downcase
    hash = {
     "#{ROOT}.#{host}.#{nodecc}.#{nodename}.state" => record.result
    }
    if record.result != 'no response'
      hash["#{ROOT}.#{host}.#{nodecc}.#{nodename}.latency"] = record.latency
    end
    @client.metrics hash, record.time
  end
end