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, agent) ⇒ PeriodicPollers

Returns a new instance of PeriodicPollers.



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

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

Instance Attribute Details

#metricObject (readonly)

Returns the value of attribute metric.



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

def metric
  @metric
end

Instance Method Details

#startObject



22
23
24
# File 'lib/logstash/instrument/periodic_pollers.rb', line 22

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

#stopObject



26
27
28
# File 'lib/logstash/instrument/periodic_pollers.rb', line 26

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