Class: Appsignal::Minutely Private

Inherits:
Object show all
Defined in:
lib/appsignal/minutely.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Defined Under Namespace

Classes: GCProbe

Class Method Summary collapse

Class Method Details

.add_gc_probeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



29
30
31
# File 'lib/appsignal/minutely.rb', line 29

def add_gc_probe
  probes << GCProbe.new
end

.probesObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

List of probes. Probes can be lamdba's or objects that respond to call.



7
8
9
# File 'lib/appsignal/minutely.rb', line 7

def probes
  @@probes ||= []
end

.startObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/appsignal/minutely.rb', line 11

def start
  Thread.new do
    begin
      loop do
        Appsignal.logger.debug("Gathering minutely metrics with #{probes.count} probe(s)")
        probes.each(&:call)
        sleep(wait_time)
      end
    rescue Exception => ex
      Appsignal.logger.error("Error in minutely thread: #{ex}")
    end
  end
end

.wait_timeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



25
26
27
# File 'lib/appsignal/minutely.rb', line 25

def wait_time
  60 - Time.now.sec
end