Sha256: c5c10e5223fbcfe2b3078e755289a63ab74a8d438a5f936635d9f5d709cbd5a8
Contents?: true
Size: 1.82 KB
Versions: 3
Compression:
Stored size: 1.82 KB
Contents
# encoding: utf-8 require 'one_apm/support/library_detection' module OneApm class Probe module Instrumentation # install instrumentations for the current framework def install_instrumentation return if @instrumented @instrumented = true # Instrumentation for the key code points inside rails for monitoring by OneApm. # note this file is loaded only if the oneapm agent is enabled (through config/oneapm.yml) instrumentation_path = File.expand_path(File.join(File.dirname(__FILE__), '..', 'inst')) Dir.glob("#{instrumentation_path}/**/*.rb").each do |inst_file| load_instrumentation_files inst_file end detect_dependencies OneApm::Agent.logger.info "Finished instrumentation" end def load_instrumentation_files pattern Dir.glob(pattern) { |file| require_instrumentation(file.to_s) } end def detect_dependencies LibraryDetection.detect! end # require specified instrumentation def require_instrumentation file require file rescue => e ::OneApm::Agent.logger.warn "Error loading instrumentation file '#{file}':", e end def install_shim # Once we install instrumentation, you can't undo that by installing the shim. if @instrumented OneApm::Agent.logger.error "Cannot install the Agent shim after instrumentation has already been installed!" OneApm::Agent.logger.error caller.join("\n") else OneApm::Agent.instance = OneApm::Agent::ShimAgent.instance end end def add_instrumentation pattern if @instrumented load_instrumentation_files pattern else @instrumentation_files << pattern end end end include Instrumentation end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
oneapm_rpm-1.1.2 | lib/one_apm/probe/instrumentation.rb |
oneapm_rpm-1.1.1 | lib/one_apm/probe/instrumentation.rb |
oneapm_rpm-1.1.0 | lib/one_apm/probe/instrumentation.rb |