Module: TingYun::Instrumentation::RackBuilder
- Defined in:
- lib/ting_yun/instrumentation/rack.rb
Instance Method Summary collapse
- #run_with_tingyun(app, *args) ⇒ Object
-
#to_app_with_tingyun_deferred_dependency_detection ⇒ Object
We patch this method for a reason that actually has nothing to do with instrumenting rack itself.
- #use_with_tingyun(middleware_class, *args, &blk) ⇒ Object
Instance Method Details
#run_with_tingyun(app, *args) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/ting_yun/instrumentation/rack.rb', line 32 def run_with_tingyun(app, *args) if ::TingYun::Instrumentation::RackHelpers.middleware_instrumentation_enabled? wrapped_app = ::TingYun::Instrumentation::MiddlewareProxy.wrap(app, true) run_without_tingyun(wrapped_app, *args) else run_without_tingyun(app, *args) end end |
#to_app_with_tingyun_deferred_dependency_detection ⇒ Object
We patch this method for a reason that actually has nothing to do with instrumenting rack itself. It happens to be a convenient and easy-to-hook point that happens late in the startup sequence of almost every application, making it a good place to do a final call to LibraryDetection.detect!, since all libraries are likely loaded at this point.
57 58 59 60 61 62 63 64 |
# File 'lib/ting_yun/instrumentation/rack.rb', line 57 def to_app_with_tingyun_deferred_dependency_detection unless ::Rack::Builder._nr_deferred_detection_ran TingYun::Agent.logger.info "Doing deferred library-detection before Rack startup" TingYun::Support::LibraryDetection.detect! ::Rack::Builder._nr_deferred_detection_ran = true end to_app_without_tingyun end |
#use_with_tingyun(middleware_class, *args, &blk) ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/ting_yun/instrumentation/rack.rb', line 42 def use_with_tingyun(middleware_class, *args, &blk) if ::TingYun::Instrumentation::RackHelpers.middleware_instrumentation_enabled? wrapped_middleware_class = ::TingYun::Instrumentation::MiddlewareProxy.for_class(middleware_class) use_without_tingyun(wrapped_middleware_class, *args, &blk) else use_without_tingyun(middleware_class, *args, &blk) end end |