module Oboe::Rails

Public Class Methods

include_helpers() click to toggle source
# File lib/oboe/frameworks/rails.rb, line 75
def self.include_helpers
  # TBD: This would make the helpers available to controllers which is occasionally desired.
  # ActiveSupport.on_load(:action_controller) do
  #   include Oboe::Rails::Helpers
  # end
  if ::Rails::VERSION::MAJOR > 2
    ActiveSupport.on_load(:action_view) do
      include Oboe::Rails::Helpers
    end
  else
    ActionView::Base.send :include, Oboe::Rails::Helpers
  end
end
load_initializer() click to toggle source
# File lib/oboe/frameworks/rails.rb, line 44
def self.load_initializer
  # Force load the TraceView Rails initializer if there is one
  # Prefer oboe.rb but give priority to the legacy tracelytics.rb if it exists
  if ::Rails::VERSION::MAJOR > 2
    rails_root = "#{::Rails.root.to_s}"
  else
    rails_root = "#{RAILS_ROOT}"
  end

  if File.exists?("#{rails_root}/config/initializers/tracelytics.rb")
    tr_initializer = "#{rails_root}/config/initializers/tracelytics.rb"
  else
    tr_initializer = "#{rails_root}/config/initializers/oboe.rb"
  end
  require tr_initializer if File.exists?(tr_initializer)
end
load_instrumentation() click to toggle source
# File lib/oboe/frameworks/rails.rb, line 61
def self.load_instrumentation
  # Load the Rails specific instrumentation
  pattern = File.join(File.dirname(__FILE__), 'rails/inst', '*.rb')
  Dir.glob(pattern) do |f|
    begin
      require f
    rescue => e
      Oboe.logger.error "[oboe/loading] Error loading rails insrumentation file '#{f}' : #{e}"
    end
  end

  Oboe.logger.info "TraceView oboe gem #{Oboe::Version::STRING} successfully loaded."
end