Class: LogStash::PipelineReporter
- Inherits:
-
Object
- Object
- LogStash::PipelineReporter
- Defined in:
- lib/logstash/pipeline_reporter.rb
Defined Under Namespace
Classes: Snapshot
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#pipeline ⇒ Object
readonly
Returns the value of attribute pipeline.
Instance Method Summary collapse
-
#initialize(logger, pipeline) ⇒ PipelineReporter
constructor
A new instance of PipelineReporter.
-
#snapshot ⇒ Object
The main way of accessing data from the reporter,, this provides a (more or less) consistent snapshot of what’s going on in the pipeline with some extra decoration.
- #to_hash ⇒ Object
Constructor Details
#initialize(logger, pipeline) ⇒ PipelineReporter
Returns a new instance of PipelineReporter.
42 43 44 45 |
# File 'lib/logstash/pipeline_reporter.rb', line 42 def initialize(logger, pipeline) @logger = logger @pipeline = pipeline end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
5 6 7 |
# File 'lib/logstash/pipeline_reporter.rb', line 5 def logger @logger end |
#pipeline ⇒ Object (readonly)
Returns the value of attribute pipeline.
5 6 7 |
# File 'lib/logstash/pipeline_reporter.rb', line 5 def pipeline @pipeline end |
Instance Method Details
#snapshot ⇒ Object
The main way of accessing data from the reporter,, this provides a (more or less) consistent snapshot of what’s going on in the pipeline with some extra decoration
50 51 52 |
# File 'lib/logstash/pipeline_reporter.rb', line 50 def snapshot Snapshot.new(self.to_hash) end |
#to_hash ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/logstash/pipeline_reporter.rb', line 54 def to_hash # pipeline.filter_queue_client.inflight_batches is synchronized pipeline.filter_queue_client.inflight_batches do |batch_map| worker_states_snap = worker_states(batch_map) # We only want to run this once inflight_count = worker_states_snap.map {|s| s[:inflight_count] }.reduce(0, :+) { :events_filtered => events_filtered, :events_consumed => events_consumed, :inflight_count => inflight_count, :worker_states => worker_states_snap, :output_info => output_info, :thread_info => pipeline.plugin_threads_info, :stalling_threads_info => pipeline.stalling_threads_info } end end |