class TingYun::Support::LibraryDetection::Dependent
Attributes
dependencies[R]
executed[R]
name[RW]
Public Class Methods
new()
click to toggle source
# File lib/ting_yun/support/library_detection.rb, line 71 def initialize @dependencies = [] @executes = [] @name = nil end
Public Instance Methods
allowed_by_config?()
click to toggle source
# File lib/ting_yun/support/library_detection.rb, line 107 def allowed_by_config? # If we don't have a name, can't check config so allow it return true if self.name.nil? key = "disable_#{self.name}".to_sym if TingYun::Agent.config[key] TingYun::Agent.logger.debug("Not installing #{self.name} instrumentation because of configuration #{key}") else true end end
check_dependencies()
click to toggle source
# File lib/ting_yun/support/library_detection.rb, line 90 def check_dependencies return false unless allowed_by_config? && dependencies dependencies.all? do |depend| begin depend.call rescue => err TingYun::Agent.logger.error( "Error while detecting #{self.name}:", err ) false end end end
dependencies_satisfied?()
click to toggle source
# File lib/ting_yun/support/library_detection.rb, line 67 def dependencies_satisfied? !executed and check_dependencies end
depends_on()
click to toggle source
# File lib/ting_yun/support/library_detection.rb, line 103 def depends_on @dependencies << Proc.new end
execute()
click to toggle source
# File lib/ting_yun/support/library_detection.rb, line 77 def execute @executes.each do |e| begin e.call rescue => err TingYun::Agent.logger.error( "Error while installing #{self.name} instrumentation:", err ) break end end ensure executed! end
executed!()
click to toggle source
# File lib/ting_yun/support/library_detection.rb, line 63 def executed! @executed = true end
executes()
click to toggle source
# File lib/ting_yun/support/library_detection.rb, line 123 def executes @executes << Proc.new end
named(new_name)
click to toggle source
# File lib/ting_yun/support/library_detection.rb, line 119 def named(new_name) self.name = new_name end