Skip to content

Commit

Permalink
Small cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
wvanbergen committed Feb 7, 2014
1 parent 49e30ce commit e252fab
Showing 1 changed file with 21 additions and 25 deletions.
46 changes: 21 additions & 25 deletions lib/statsd/instrument.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,6 @@
require 'statsd/instrument/version'

module StatsD
class << self
attr_accessor :host, :port, :mode, :logger, :enabled, :default_sample_rate,
:prefix, :implementation
end

def self.server=(conn)
self.host, port = conn.split(':')
self.port = port.to_i
invalidate_socket
end

def self.host=(host)
@host = host
invalidate_socket
end

def self.port=(port)
@port = port
invalidate_socket
end

def self.invalidate_socket
@socket = nil
end

module Instrument

def self.generate_metric_name(metric_name, callee, *args)
Expand Down Expand Up @@ -134,6 +109,27 @@ def remove_from_method(method, name, action)
end

class << self
attr_accessor :host, :port, :mode, :logger, :enabled, :default_sample_rate, :prefix, :implementation

def server=(conn)
self.host, port = conn.split(':')
self.port = port.to_i
invalidate_socket
end

def host=(host)
@host = host
invalidate_socket
end

def port=(port)
@port = port
invalidate_socket
end

def invalidate_socket
@socket = nil
end

# glork:320|ms
def measure(key, value = nil, *metric_options)
Expand Down

0 comments on commit e252fab

Please sign in to comment.