Sha256: da0f3ac094f87a7b18d2d5e862239d2fbeb695f004c1d32ebe8912cb6b5dc421

Contents?: true

Size: 844 Bytes

Versions: 3

Compression:

Stored size: 844 Bytes

Contents

require 'graphite-api'

module Ring
class SQA

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

    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

    private
    
    def initialize nodes, server=CFG.graphite
      @client = GraphiteAPI.new graphite: server
      @hostname = Ring::SQA::CFG.host.name
      @nodes = nodes
    end
  end

end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ring-sqa-0.4.3 lib/ring/sqa/graphite.rb
ring-sqa-0.4.2 lib/ring/sqa/graphite.rb
ring-sqa-0.4.1 lib/ring/sqa/graphite.rb