Class: Rack::StatsdBatch

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/statsd_batch.rb

Defined Under Namespace

Classes: Connection, Recorder

Instance Method Summary collapse

Constructor Details

#initialize(rack_app, hostname, port, mtu = 1432) ⇒ StatsdBatch



5
6
7
8
9
10
# File 'lib/rack/statsd_batch.rb', line 5

def initialize rack_app, hostname, port, mtu=1432
  @app = rack_app
  @hostname = hostname
  @port = port
  @mtu = mtu
end

Instance Method Details

#call(env) ⇒ Object



12
13
14
15
16
17
# File 'lib/rack/statsd_batch.rb', line 12

def call env
  env['metrics'] = Rack::StatsdBatch::Recorder.new
  status, headers, response = @app.call(env)
  env['metrics'].publish(@hostname, @port, @mtu)
  [status, headers, response]
end