Class: MultiStatsd::Server

Inherits:
EventMachine::Connection
  • Object
show all
Defined in:
lib/multi-statsd/server.rb

Overview

Eventmachine connection which receives UDP data and writes it to various backends

Instance Method Summary collapse

Constructor Details

#initialize(backends = [], *args) ⇒ Server

Initialize the server with one or more backends

Parameters:



6
7
8
9
# File 'lib/multi-statsd/server.rb', line 6

def initialize(backends = [], *args)
  @backends = [backends].flatten
  super
end

Instance Method Details

#receive_data(data) ⇒ nil

Write out statsd data to each registered backend

Parameters:

  • data (String)

    Data in statsd format

Returns:

  • (nil)


14
15
16
17
18
19
20
# File 'lib/multi-statsd/server.rb', line 14

def receive_data(data)
  @backends.each do |backend|
    backend.write(data)
  end
  
  nil
end