lib/statsd/instrument.rb in statsd-instrument-1.6.0 vs lib/statsd/instrument.rb in statsd-instrument-1.6.1

- old
+ new

@@ -6,15 +6,11 @@ module StatsD class << self attr_accessor :host, :port, :mode, :logger, :enabled, :default_sample_rate, :prefix, :implementation end - self.enabled = true - self.default_sample_rate = 1.0 - self.implementation = :statsd - # StatsD.server = 'localhost:1234' def self.server=(conn) self.host, port = conn.split(':') self.port = port.to_i invalidate_socket end @@ -223,5 +219,10 @@ command << "\n" if self.implementation == :statsite return command end end + +StatsD.enabled = true +StatsD.default_sample_rate = 1.0 +StatsD.implementation = ENV.fetch('STATSD_IMPLEMENTATION', 'statsd').to_sym +StatsD.server = ENV['STATSD_ADDR'] if ENV.has_key?('STATSD_ADDR')