module Instrumentation

Instrumentation

Start a server by calling:

Instrumentation.start_server(Process.pid)

By default the server is started on localhost:8080

Constants

VERSION

Public Class Methods

root() click to toggle source
# File lib/instrumentation.rb, line 32
def root
  Pathname.new(__FILE__).join('..', '..')
end
start_server(pid:, port: 8080) click to toggle source
# File lib/instrumentation.rb, line 17
def start_server(pid:, port: 8080)
  report = Report.new(pid)
  app = RackApp.new(report)
  server = Webserver.new

  report.start
  server.run(app, port: port)

  [server, report].map(&:join)
rescue Interrupt => _
  print "\n=> Shutting down instrumentation.\n"
  report.shutdown
  server.stop
end

Private Instance Methods

root() click to toggle source
# File lib/instrumentation.rb, line 32
def root
  Pathname.new(__FILE__).join('..', '..')
end
start_server(pid:, port: 8080) click to toggle source
# File lib/instrumentation.rb, line 17
def start_server(pid:, port: 8080)
  report = Report.new(pid)
  app = RackApp.new(report)
  server = Webserver.new

  report.start
  server.run(app, port: port)

  [server, report].map(&:join)
rescue Interrupt => _
  print "\n=> Shutting down instrumentation.\n"
  report.shutdown
  server.stop
end