Class: LogStash::Instrument::PeriodicPollers

Inherits:
Object
  • Object
show all
Defined in:
lib/logstash/instrument/periodic_pollers.rb

Overview

Each PeriodPoller manager his own thread to do the poller of the stats, this class encapsulate the starting and stopping of the poller if the unique timer uses too much resource we can refactor this behavior here.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(metric, queue_type, pipelines) ⇒ PeriodicPollers

Returns a new instance of PeriodicPollers.



13
14
15
16
17
18
# File 'lib/logstash/instrument/periodic_pollers.rb', line 13

def initialize(metric, queue_type, pipelines)
  @metric = metric
  @periodic_pollers = [PeriodicPoller::Os.new(metric),
                       PeriodicPoller::JVM.new(metric),
                       PeriodicPoller::PersistentQueue.new(metric, queue_type, pipelines)]
end

Instance Attribute Details

#metricObject (readonly)

Returns the value of attribute metric.



11
12
13
# File 'lib/logstash/instrument/periodic_pollers.rb', line 11

def metric
  @metric
end

Instance Method Details

#startObject



20
21
22
# File 'lib/logstash/instrument/periodic_pollers.rb', line 20

def start
  @periodic_pollers.map(&:start)
end

#stopObject



24
25
26
# File 'lib/logstash/instrument/periodic_pollers.rb', line 24

def stop
  @periodic_pollers.map(&:stop)
end