Module: MetrixWire::Instrument::RackBuilder
- Defined in:
- lib/metrixwire/instrument/rack_builder.rb
Overview
Auto-inserts Rack into any Rack app that isn't Rails, by
patching Rack::Builder#to_app to wrap the built app once. This is what
makes Sinatra / bare Rack "zero-wiring": the user never adds use.
Rails is handled by the Railtie instead (this patch skips when Rails is defined so we don't double-wrap).
Defined Under Namespace
Modules: Patch
Class Method Summary collapse
Class Method Details
.install ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/metrixwire/instrument/rack_builder.rb', line 14 def install return unless defined?(::Rack::Builder) return if ::Rack::Builder.instance_variable_get(:@__metrixwire_patched) ::Rack::Builder.prepend(Patch) ::Rack::Builder.instance_variable_set(:@__metrixwire_patched, true) rescue StandardError nil end |