class Config
Represents a configuration for the traces library.
Definitions
def self.load(path)
Load the configuration from the given path.
Signature
-
parameter
path
String
The path to the configuration file.
-
returns
Config
The loaded configuration.
Implementation
def self.load(path)
config = self.new
if File.exist?(path)
config.instance_eval(File.read(path), path)
end
return config
end
def self.default
Load the default configuration.
Signature
-
returns
Config
The default configuration.
Implementation
def self.default
@default ||= self.load(DEFAULT_PATH)
end
def prepare
Prepare the backend, e.g. by loading additional libraries or instrumentation.
Implementation
def prepare
end
def require_backend(env = ENV)
Require a specific traces backend implementation.
Implementation
def require_backend(env = ENV)
if backend = env['TRACES_BACKEND']
begin
if require(backend)
Traces.extend(Backend::Interface)
return true
end
rescue LoadError => error
warn "Unable to load traces backend: #{backend.inspect}!"
end
end
return false
end
DEFAULT = self.default
Load the default configuration.