lib/fozzie/configuration.rb in fozzie-0.0.25 vs lib/fozzie/configuration.rb in fozzie-0.0.26
- old
+ new
@@ -8,23 +8,29 @@
# Fozzie configuration allows assignment of global properties
# that will be used within the Fozzie codebase.
class Configuration
include Sys
- attr_accessor :env, :config_path, :host, :port, :appname, :namespaces, :timeout, :monitor_classes, :sniff_envs
+ attr_accessor :env, :config_path, :host, :port, :appname, :namespaces, :timeout, :monitor_classes, :sniff_envs, :ignore_prefix
def initialize(args = {})
merge_and_assign_config(args)
self.origin_name
end
+ def disable_prefix
+ @ignore_prefix = true
+ end
+
# Returns the prefix for any stat requested to be registered
def data_prefix
- s = [appname, origin_name, env].collect do |s|
+ return nil if @ignore_prefix
+
+ @data_prefix ||= [appname, origin_name, env].collect do |s|
s.empty? ? nil : s.gsub('.', '-')
end.compact.join('.').strip
- (s.empty? ? nil : s)
+ (@data_prefix.empty? ? nil : @data_prefix)
end
# Returns the origin name of the current machine to register the stat against
def origin_name
@origin_name ||= Uname.nodename
@@ -54,10 +60,11 @@
:env => (ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'development'),
:appname => '',
:namespaces => %w{Stats S Statistics Warehouse},
:timeout => 0.5,
:monitor_classes => [],
- :sniff_envs => [:development, :staging, :production]
+ :sniff_envs => [:development, :staging, :production],
+ :ignore_prefix => false
}.dup
end
# Loads the configuration from YAML, if possible
def config_from_yaml(args)
\ No newline at end of file