class ScoutApm::Agent::Preconditions
Constants
- PRECONDITIONS
-
The preconditions here must be a 2 element hash, with :message and :check. message: Proc that takes the environment, and returns a string check: Proc that takes an
AgentContext
and returns true if precondition was met, if false, we shouldn’t start. severity: Severity of the log message (one of: :debug, :info, :warn, :error or :fatal)
Public Instance Methods
Source
# File lib/scout_apm/agent/preconditions.rb, line 51 def check?(context) @check_result ||= begin failed_preconditions = PRECONDITIONS.inject(Array.new) { |errors, condition| unless condition[:check].call(context) errors << { :severity => condition[:severity], :message => condition[:message].call(context.environment), } end errors } if failed_preconditions.any? failed_preconditions.each {|error| context.logger.send(error[:severity], error[:message]) } force? # if forced, return true anyway else # No errors, we met preconditions true end end end
Source
# File lib/scout_apm/agent/preconditions.rb, line 76 def force? false end
XXX: Wire up options here and below in the appserver & bg server detections