Permalink
Browse files

Merge branch 'use_environment_variable'

  • Loading branch information...
2 parents fa7bff5 + a8966d1 commit ba821db418a1ec2d2e9a79762f9fbfdf20a33db9 @wvanbergen wvanbergen committed Feb 5, 2014
Showing with 5 additions and 4 deletions.
  1. +5 −4 lib/statsd/instrument.rb
View
@@ -8,11 +8,7 @@ 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
@@ -225,3 +221,8 @@ def self.generate_packet(k, v, op, sample_rate = default_sample_rate, tags = nil
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')

0 comments on commit ba821db

Please sign in to comment.