Module: OneApm::Agent::Instrumentation::RackBuilder
- Defined in:
- lib/one_apm/inst/rack/rack_builder.rb
Instance Method Summary collapse
- #_check_for_late_instrumentation(app) ⇒ Object
- #run_with_oneapm(app, *args) ⇒ Object
-
#to_app_with_oneapm_deferred_library_detection ⇒ Object
defered detection to avoid something later required.
- #use_with_oneapm(middleware_class, *args, &blk) ⇒ Object
Instance Method Details
#_check_for_late_instrumentation(app) ⇒ Object
38 39 40 41 42 43 44 45 46 |
# File 'lib/one_apm/inst/rack/rack_builder.rb', line 38 def _check_for_late_instrumentation(app) return if @checked_for_late_instrumentation @checked_for_late_instrumentation = true unless OneApm::Manager.config[:disable_rack_middleware] if ::OneApm::Rack::MiddlewareWrapper.needs_wrapping?(app) # TODO Fix it in the future end end end |
#run_with_oneapm(app, *args) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/one_apm/inst/rack/rack_builder.rb', line 6 def run_with_oneapm(app, *args) unless OneApm::Manager.config[:disable_rack_middleware] wrapped_app = ::OneApm::Rack::MiddlewareWrapper.wrap(app, true) run_without_oneapm(wrapped_app, *args) else run_without_oneapm(app, *args) end end |
#to_app_with_oneapm_deferred_library_detection ⇒ Object
defered detection to avoid something later required
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/one_apm/inst/rack/rack_builder.rb', line 25 def to_app_with_oneapm_deferred_library_detection unless ::Rack::Builder._oa_deferred_detection_ran OneApm::Manager.logger.info "Doing deferred library-detection before Rack startup" LibraryDetection.detect! ::Rack::Builder._oa_deferred_detection_ran = true end result = to_app_without_oneapm _check_for_late_instrumentation(result) result end |
#use_with_oneapm(middleware_class, *args, &blk) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/one_apm/inst/rack/rack_builder.rb', line 15 def use_with_oneapm(middleware_class, *args, &blk) unless OneApm::Manager.config[:disable_rack_middleware] wrapped_middleware_class = ::OneApm::Rack::MiddlewareWrapper.wrap_class(middleware_class) use_without_oneapm(wrapped_middleware_class, *args, &blk) else use_without_oneapm(middleware_class, *args, &blk) end end |