module Oboe::Loading
This module houses all of the loading functionality for the oboe gem.
Note that this does not necessarily have to include initialization routines (although it can).
Actual initialization is often separated out as it can be dependent on on the state of the stack boot process. e.g. code requiring that initializers, frameworks or instrumented libraries are already loaded…
Public Class Methods
load_access_key()
click to toggle source
Load the TraceView access key (either from system configuration file or environment variable) and calculate internal RUM ID
# File lib/oboe/loading.rb, line 44 def self.load_access_key if ENV.key?('TRACEVIEW_CUUID') # Preferably get access key from environment (e.g. Heroku) Oboe::Config[:access_key] = ENV['TRACEVIEW_CUUID'] Oboe::Config[:rum_id] = Oboe::Util::Base64URL.encode(Digest::SHA1.digest('RUM' + Oboe::Config[:access_key])) else # ..else read from system-wide configuration file if Oboe::Config.access_key.empty? config_file = '/etc/tracelytics.conf' return unless File.exist?(config_file) File.open(config_file).each do |line| if line =~ /^tracelyzer.access_key=/ || 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 end end rescue StandardError => e Oboe.logger.error "Trouble obtaining access_key and rum_id: #{e.inspect}" end
require_api()
click to toggle source
Load the oboe tracing API
# File lib/oboe/loading.rb, line 72 def self.require_api 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.logger.fatal "[oboe/error] Couldn't load oboe api: #{e.message}" end end