Class: EventMachine::Statsd
- Inherits:
-
Statsd
- Object
- Statsd
- EventMachine::Statsd
- Defined in:
- lib/event_machine/statsd.rb,
lib/event_machine/version.rb
Constant Summary collapse
- VERSION =
'1.0.0'
Instance Method Summary collapse
- #connect ⇒ Object
-
#initialize(*args) ⇒ Statsd
constructor
A new instance of Statsd.
- #send_to_socket(message) ⇒ Object
Constructor Details
#initialize(*args) ⇒ Statsd
Returns a new instance of Statsd.
10 11 12 |
# File 'lib/event_machine/statsd.rb', line 10 def initialize(*args) super end |
Instance Method Details
#connect ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/event_machine/statsd.rb', line 14 def connect @s_mu.synchronize do begin @socket.close if @socket rescue self.class.logger.error { 'Statsd: can not close connection' } if self.class.logger end case @protocol when :tcp @socket = EMStatsd::TCPWrapper.new host, port else @socket = EMStatsd::UDPWrapper.new host, port end end end |
#send_to_socket(message) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/event_machine/statsd.rb', line 31 def send_to_socket() socket.write() rescue => boom self.class.logger.error { "Statsd: #{boom.class} #{boom}" } if self.class.logger nil end |