Class: PassengerDatadog

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

Instance Method Summary collapse

Instance Method Details

#run ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/passenger_datadog.rb', line 12

def run
  status = strip_header(collect)
  return if status.nil?

  statsd = Datadog::Statsd.new(single_thread: true, buffer_max_pool_size: 1)
  begin
    run_parsers(statsd, Nokogiri::XML(status))
  ensure
    # Closing releases the socket; skipping it on a parser error would leak one
    # file descriptor per collection run for the life of the service.
    statsd.close
  end
end