Module: Oboe::Loading

Defined in:
lib/oboe/loading.rb

Class Method Summary collapse

Class Method Details

.load_access_keyObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/oboe/loading.rb', line 28

def self.load_access_key
  unless Oboe::Config.has_key?(:access_key)  
    config_file = '/etc/tracelytics.conf'
    return unless File.exists?(config_file)
    
    begin
      File.open(config_file).each do |line|
        if line =~ /^tracelyzer.access_key=/ or line =~ /^access_key/
          bits = line.split(/=/)
          Oboe::Config[:access_key] = bits[1].strip
          Oboe::Config[:rum_id] = Oboe::Util::Base64URL.encode(Digest::SHA1.digest("RUM" + Oboe::Config[:access_key]))
          break
        end
      end
    rescue
      puts "Having trouble parsing #{config_file}..."
    end
  end
end

.load_framework_instrumentationObject



66
67
68
69
70
71
72
73
74
75
# File 'lib/oboe/loading.rb', line 66

def self.load_framework_instrumentation
  pattern = File.join(File.dirname(__FILE__), 'frameworks/*/', '*.rb')
  Dir.glob(pattern) do |f|
    begin
      require f
    rescue => e
      $stderr.puts "[oboe/loading] Error loading framework file '#{f}' : #{e}"
    end
  end
end

.require_apiObject



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/oboe/loading.rb', line 48

def self.require_api
  require 'oboe/version'

  pattern = File.join(File.dirname(__FILE__), 'api', '*.rb')
  Dir.glob(pattern) do |f|
    require f
  end
  require 'oboe/api'

  begin
    Oboe::API.extend_with_tracing
  rescue LoadError => e
    Oboe::API.extend_with_noop
  end
  
  require 'oboe/config'
end