Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Removing the enabled flag as it isn't very useful

  • Loading branch information...
commit f8a090f3aa996bc9c38397c06c839a9f342a47e5 1 parent 1682317
@raykrueger raykrueger authored
Showing with 3 additions and 21 deletions.
  1. +3 −6 lib/statsd.rb
  2. +0 −15 spec/statsd_spec.rb
View
9 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
View
15 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
Please sign in to comment.
Something went wrong with that request. Please try again.