Class: Appsignal::Minutely

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

Defined Under Namespace

Classes: GCProbe

Class Method Summary collapse

Class Method Details

.add_gc_probeObject



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

def add_gc_probe
  probes << GCProbe.new
end

.probesObject

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



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

def probes
  @@probes ||= []
end

.startObject



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

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



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

def wait_time
  60 - Time.now.sec
end