Module: TingYun::Frameworks::Instrumentation
- Included in:
- InstanceMethods
- Defined in:
- lib/ting_yun/frameworks/instrumentation.rb
Overview
Contains methods that relate to adding and executing files that contain instrumentation for the Ruby Agent
Instance Method Summary collapse
- #add_instrumentation(pattern) ⇒ Object
- #detect_dependencies ⇒ Object
-
#install_instrumentation ⇒ Object
Signals the agent that it’s time to actually load the instrumentation files.
-
#load_instrumentation_files(pattern) ⇒ Object
Adds a list of files in Dir.glob format (e.g. ‘/app/foo/*/_instrumentation.rb’) This requires the files within a rescue block, so that any errors within instrumentation files do not affect the overall agent or application in which it runs.
Instance Method Details
#add_instrumentation(pattern) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/ting_yun/frameworks/instrumentation.rb', line 19 def add_instrumentation(pattern) if @instrumented load_instrumentation_files pattern else @instrumentation_files << pattern end end |
#detect_dependencies ⇒ Object
42 43 44 |
# File 'lib/ting_yun/frameworks/instrumentation.rb', line 42 def detect_dependencies LibraryDetection.detect! end |
#install_instrumentation ⇒ Object
Signals the agent that it’s time to actually load the instrumentation files. May be overridden by subclasses
14 15 16 |
# File 'lib/ting_yun/frameworks/instrumentation.rb', line 14 def install_instrumentation _install_instrumentation end |
#load_instrumentation_files(pattern) ⇒ Object
Adds a list of files in Dir.glob format (e.g. ‘/app/foo/*/_instrumentation.rb’) This requires the files within a rescue block, so that any errors within instrumentation files do not affect the overall agent or application in which it runs.
32 33 34 35 36 37 38 39 40 |
# File 'lib/ting_yun/frameworks/instrumentation.rb', line 32 def load_instrumentation_files(pattern) Dir.glob(pattern) do |file| begin require file.to_s rescue LoadError => e TingYun::Agent.logger.warn "Error loading instrumentation file '#{file}':", e end end end |