Class: ScoutApm::Debug

Inherits:
Object
  • Object
show all
Defined in:
lib/scout_apm/debug.rb

Constant Summary collapse

@@instance =

see self.instance

nil

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.instanceObject



6
7
8
# File 'lib/scout_apm/debug.rb', line 6

def self.instance
  @@instance ||= new
end

Instance Method Details

#call_periodic_hooksObject



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/scout_apm/debug.rb', line 14

def call_periodic_hooks
  @periodic_hooks.each do |hook|
    begin
      hook.call
    rescue => e
      logger.info("Periodic debug hook failed to run: #{e}\n\t#{e.backtrace.join("\n\t")}")
    end
  end
rescue
  # Something went super wrong for the inner rescue to not catch this. Just
  # swallow the error. The debug tool should never crash the app.
end

#register_periodic_hook(&hook) ⇒ Object



10
11
12
# File 'lib/scout_apm/debug.rb', line 10

def register_periodic_hook(&hook)
  @periodic_hooks << hook
end