Class: InflightEventsReporter

Inherits:
Object
  • Object
show all
Defined in:
lib/logstash/util/reporter.rb

Class Method Summary collapse

Class Method Details

.logger=(logger) ⇒ Object



3
4
5
# File 'lib/logstash/util/reporter.rb', line 3

def self.logger=(logger)
  @logger = logger
end

.report(input_to_filter, filter_to_output, outputs) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/logstash/util/reporter.rb', line 16

def self.report(input_to_filter, filter_to_output, outputs)
  report = {
    "input_to_filter" => input_to_filter.size,
    "filter_to_output" => filter_to_output.size,
    "outputs" => []
  }
  outputs.each do |output|
    next unless output.worker_queue && output.worker_queue.size > 0
    report["outputs"] << [output.inspect, output.worker_queue.size]
  end
  @logger.warn ["INFLIGHT_EVENTS_REPORT", Time.now.iso8601, report]
end

.start(input_to_filter, filter_to_output, outputs) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/logstash/util/reporter.rb', line 7

def self.start(input_to_filter, filter_to_output, outputs)
  Thread.new do
    loop do
      sleep 5
      report(input_to_filter, filter_to_output, outputs)
    end
  end
end