Class: StatsdServer::Input::Udp
- Inherits:
-
EventMachine::Connection
- Object
- EventMachine::Connection
- StatsdServer::Input::Udp
- Defined in:
- lib/statsdserver/input/udp.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#stats ⇒ Object
Returns the value of attribute stats.
Instance Method Summary collapse
-
#initialize ⇒ Udp
constructor
A new instance of Udp.
- #receive_data(packet) ⇒ Object
Constructor Details
#initialize ⇒ Udp
Returns a new instance of Udp.
12 13 14 |
# File 'lib/statsdserver/input/udp.rb', line 12 def initialize @logger = Logger.new(STDOUT) end |
Instance Attribute Details
#logger ⇒ Object
Returns the value of attribute logger.
8 9 10 |
# File 'lib/statsdserver/input/udp.rb', line 8 def logger @logger end |
#stats ⇒ Object
Returns the value of attribute stats.
8 9 10 |
# File 'lib/statsdserver/input/udp.rb', line 8 def stats @stats end |
Instance Method Details
#receive_data(packet) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/statsdserver/input/udp.rb', line 17 def receive_data(packet) raise "@stats must be set" unless @stats begin StatsdServer::Proto::V1.parse(packet, @stats) rescue StatsdServer::Proto::ParseError => e @logger.warn(e.) end end |