lib/ting_yun/frameworks/instrumentation.rb in tingyun_rpm-1.2.0 vs lib/ting_yun/frameworks/instrumentation.rb in tingyun_rpm-1.3.0

- old
+ new

@@ -30,10 +30,15 @@ # errors within instrumentation files do not affect the overall # agent or application in which it runs. def load_instrumentation_files(pattern) Dir.glob(pattern) do |file| begin - require file.to_s + if file.to_s.include?('instrumentation/kafka.rb') + # (**options) will report syntax error when ruby version under 2.0.0 + require file.to_s if (defined? RUBY_VERSION) && (TingYun::Support::VersionNumber.new(RUBY_VERSION) >= TingYun::Support::VersionNumber.new('2.0.0'.freeze)) + else + require file.to_s + end rescue LoadError => e TingYun::Agent.logger.warn "Error loading instrumentation file '#{file}':", e end end end