lib/ting_yun/instrumentation/rake.rb in tingyun_rpm-1.4.2 vs lib/ting_yun/instrumentation/rake.rb in tingyun_rpm-1.5.0
- old
+ new
@@ -5,11 +5,11 @@
named :rake
depends_on do
defined?(::Rake)&&
!::TingYun::Agent.config[:'disable_rake'] &&
- ::TingYun::Agent.config[:'rake.tasks'].any? &&
+ ::TingYun::Agent::Instrumentation::RakeInstrumentation.supported_instrument? &&
::TingYun::Agent::Instrumentation::RakeInstrumentation.supported_version?
end
executes do
::TingYun::Agent.logger.info 'Installing deferred Rake instrumentation'
@@ -57,13 +57,13 @@
rescue => e
TingYun::Agent.logger.error("Error during Rake task invoke", e)
end
def self.should_trace? name
- TingYun::Agent.config[:'rake.tasks'].any? do |task|
- task == name
- end
+ return ::TingYun::Agent.config[:'rake.tasks'].include?(name) if ::TingYun::Agent.config[:'rake.tasks'].any?
+ return !TingYun::Agent.config[:'rake.black.tasks'].include?(name) if ::TingYun::Agent.config[:'rake.black.tasks'].any?
+ return false
end
def self.ensure_at_exit
return if @installed_at_exit
@@ -103,9 +103,13 @@
TingYun::Agent::MethodTracerHelpers.trace_execution_scoped("Rake/execute/multitask") do
super
end
end
end
+ end
+
+ def self.supported_instrument?
+ ::TingYun::Agent.config[:'rake.tasks'].any? or ::TingYun::Agent.config[:'rake.black.tasks'].any?
end
end
end
end
end
\ No newline at end of file