Module: OneApm::Probe::Instrumentation
- Included in:
- OneApm::Probe
- Defined in:
- lib/one_apm/probe/instrumentation.rb
Instance Method Summary collapse
- #add_instrumentation(pattern) ⇒ Object
- #detect_dependencies ⇒ Object
- #install_instrumentation ⇒ Object
- #install_shim ⇒ Object
- #load_instrumentation_files(pattern) ⇒ Object
- #require_instrumentation(file) ⇒ Object
Instance Method Details
#add_instrumentation(pattern) ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/one_apm/probe/instrumentation.rb', line 45 def add_instrumentation pattern if @instrumented load_instrumentation_files pattern else @instrumentation_files << pattern end end |
#detect_dependencies ⇒ Object
26 27 28 |
# File 'lib/one_apm/probe/instrumentation.rb', line 26 def detect_dependencies LibraryDetection.detect! end |
#install_instrumentation ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/one_apm/probe/instrumentation.rb', line 9 def install_instrumentation return if @instrumented @instrumented = true instrumentation_path = File.(File.join(File.dirname(__FILE__), '..', 'inst')) Dir.glob("#{instrumentation_path}/**/*.rb").each do |inst_file| load_instrumentation_files inst_file end detect_dependencies OneApm::Manager.logger.info "Finished instrumentation" end |
#install_shim ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/one_apm/probe/instrumentation.rb', line 36 def install_shim if @instrumented OneApm::Manager.logger.error "Cannot install the Agent shim after instrumentation has already been installed!" OneApm::Manager.logger.error caller.join("\n") else OneApm::Manager.agent = OneApm::Agent::ShimAgent.instance end end |
#load_instrumentation_files(pattern) ⇒ Object
22 23 24 |
# File 'lib/one_apm/probe/instrumentation.rb', line 22 def load_instrumentation_files pattern Dir.glob(pattern) { |file| require_instrumentation(file.to_s) } end |