class ScoutApm::Debug

Public Class Methods

instance() click to toggle source
# File lib/scout_apm/debug.rb, line 6
def self.instance
  @@instance ||= new
end
new() click to toggle source
# File lib/scout_apm/debug.rb, line 29
def initialize
  @periodic_hooks = []
end

Public Instance Methods

call_periodic_hooks() click to toggle source
# 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) click to toggle source
# File lib/scout_apm/debug.rb, line 10
def register_periodic_hook(&hook)
  @periodic_hooks << hook
end

Private Instance Methods

logger() click to toggle source
# File lib/scout_apm/debug.rb, line 33
def logger
  ScoutApm::Agent.instance.context.logger
end