Class: PassengerDatadog

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

Instance Method Summary collapse

Instance Method Details

#runObject



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

def run
  status = `passenger-status --show=xml`
  return if status.empty?

  # Good job Passenger 4.0.10. Return non xml in your xml output.
  status = status.split("\n")[3..-1].join("\n") unless status.start_with?('<?xml')

  statsd = Datadog::Statsd.new
  parsed = Nokogiri::XML(status)

  statsd.batch do |batch|
    run_in_batch(batch, parsed)
  end
end