Class: Fluent::DeisGraphiteOutput

Inherits:
Output
  • Object
show all
Defined in:
lib/fluent/plugin/out_deis-graphite.rb

Instance Method Summary collapse

Constructor Details

#initializeDeisGraphiteOutput

Returns a new instance of DeisGraphiteOutput.



16
17
18
# File 'lib/fluent/plugin/out_deis-graphite.rb', line 16

def initialize
  super
end

Instance Method Details

#configure(conf) ⇒ Object



31
32
33
# File 'lib/fluent/plugin/out_deis-graphite.rb', line 31

def configure(conf)
  super
end

#emit(tag, es, chain) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/fluent/plugin/out_deis-graphite.rb', line 35

def emit(tag, es, chain)
  es.each do |time,record|
    if record.key? "kubernetes"
      if record["kubernetes"]["container_name"] == "deis-router"
        split_message = record["log"].split(" - ")
        app = split_message[1].strip
        status_code = split_message[4].strip
        #bytes_sent = split_message[6].strip.to_f
        #response_time = split_message[12].strip.to_f
        #request_time = split_message[13].strip.to_f

        Metriks.meter("response_rates.#{record["kubernetes"]["pod_name"]}.#{app}.#{status_code}").mark
      end
     end
  end
  chain.next
end

#shutdownObject



27
28
29
# File 'lib/fluent/plugin/out_deis-graphite.rb', line 27

def shutdown
  super
end

#startObject



20
21
22
23
24
25
# File 'lib/fluent/plugin/out_deis-graphite.rb', line 20

def start
  super
  puts "Starting reporter: #{@graphite_url}:#{@graphite_port}/#{@graphite_interval}"
  @reporter = Metriks::Reporter::Graphite.new @graphite_url, @graphite_port,:interval => @graphite_interval
  @reporter.start
end