Class: Instrumentation::Webserver
- Inherits:
-
Object
- Object
- Instrumentation::Webserver
- Defined in:
- lib/instrumentation/webserver.rb
Overview
Webserver using ‘puma` that handles requests for stats
Instance Method Summary collapse
-
#initialize ⇒ Webserver
constructor
A new instance of Webserver.
- #join ⇒ Object
- #run(app, opts = {}) ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize ⇒ Webserver
Returns a new instance of Webserver.
4 5 6 |
# File 'lib/instrumentation/webserver.rb', line 4 def initialize @worker = nil end |
Instance Method Details
#join ⇒ Object
15 16 17 |
# File 'lib/instrumentation/webserver.rb', line 15 def join @worker.join end |
#run(app, opts = {}) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/instrumentation/webserver.rb', line 8 def run(app, opts = {}) config = build_config(opts.merge(app: app)) @launcher = Puma::Launcher.new(config, events: Puma::Events.stdio) @worker = Thread.new { @launcher.run } end |
#stop ⇒ Object
19 20 21 22 |
# File 'lib/instrumentation/webserver.rb', line 19 def stop @launcher.stop @worker.kill end |