Class: Appsignal::Minutely
Defined Under Namespace
Classes: GCProbe
Class Method Summary collapse
- .add_gc_probe ⇒ Object
-
.probes ⇒ Object
List of probes.
- .start ⇒ Object
- .wait_time ⇒ Object
Class Method Details
.add_gc_probe ⇒ Object
28 29 30 |
# File 'lib/appsignal/minutely.rb', line 28 def add_gc_probe probes << GCProbe.new end |
.probes ⇒ Object
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 |
.start ⇒ Object
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_time ⇒ Object
24 25 26 |
# File 'lib/appsignal/minutely.rb', line 24 def wait_time 60 - Time.now.sec end |