diff --git a/lib/statsd.rb b/lib/statsd.rb index 298610f0..9bb8a86f 100644 --- a/lib/statsd.rb +++ b/lib/statsd.rb @@ -15,7 +15,6 @@ class Statsd # A namespace to prepend to all statsd calls. attr_accessor :namespace - attr_accessor :enabled #characters that will be replaced with _ in stat names RESERVED_CHARS_REGEX = /[\:\|\@]/ @@ -28,8 +27,8 @@ class << self # @param [String] host your statsd host # @param [Integer] port your statsd port - def initialize(host, port=8125, enabled=true) - @host, @port, @enabled = host, port, enabled + def initialize(host, port=8125) + @host, @port = host, port end # Sends an increment (count = 1) for the given stat to the statsd server. @@ -78,8 +77,6 @@ def time(stat, sample_rate=1) result end - def enabled?; enabled end - private def sampled(sample_rate) @@ -94,7 +91,7 @@ def send(stat, delta, type, sample_rate) def send_to_socket(message) self.class.logger.debug {"Statsd: #{message}"} if self.class.logger - socket.send(message, 0, @host, @port) if @enabled + socket.send(message, 0, @host, @port) end def socket; @socket ||= UDPSocket.new end diff --git a/spec/statsd_spec.rb b/spec/statsd_spec.rb index ef5c2477..6c6523cf 100644 --- a/spec/statsd_spec.rb +++ b/spec/statsd_spec.rb @@ -157,21 +157,6 @@ def socket; @socket ||= FakeUDPSocket.new end @log.string.must_be_empty end - describe "while disabled" do - before { @statsd.enabled = false } - - it "should be disabled" do - @statsd.enabled.must_equal false - @statsd.enabled?.must_equal false - end - - it "should not send data to the socket but should still log" do - @statsd.increment('foo', 1) - @statsd.socket.recv.must_be_nil - @log.string.must_match "Statsd: foo:1|c" - end - - end end describe "stat names" do