module Mmtrix::Agent::Instrumentation::RackBuilder
Public Instance Methods
run_with_mmtrix(app, *args)
click to toggle source
# File lib/mmtrix/agent/instrumentation/rack.rb, line 80 def run_with_mmtrix(app, *args) if ::Mmtrix::Agent::Instrumentation::RackHelpers.middleware_instrumentation_enabled? wrapped_app = ::Mmtrix::Agent::Instrumentation::MiddlewareProxy.wrap(app, true) run_without_mmtrix(wrapped_app, *args) else run_without_mmtrix(app, *args) end end
to_app_with_mmtrix_deferred_dependency_detection()
click to toggle source
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 DependencyDetection.detect!, since all libraries are likely loaded at this point.
# File lib/mmtrix/agent/instrumentation/rack.rb, line 104 def to_app_with_mmtrix_deferred_dependency_detection unless ::Rack::Builder._nr_deferred_detection_ran Mmtrix::Agent.logger.info "Doing deferred dependency-detection before Rack startup" DependencyDetection.detect! ::Rack::Builder._nr_deferred_detection_ran = true end result = to_app_without_mmtrix ::Mmtrix::Agent::Instrumentation::RackHelpers.check_for_late_instrumentation(result) result end
use_with_mmtrix(middleware_class, *args, &blk)
click to toggle source
# File lib/mmtrix/agent/instrumentation/rack.rb, line 89 def use_with_mmtrix(middleware_class, *args, &blk) if ::Mmtrix::Agent::Instrumentation::RackHelpers.middleware_instrumentation_enabled? wrapped_middleware_class = ::Mmtrix::Agent::Instrumentation::MiddlewareProxy.for_class(middleware_class) use_without_mmtrix(wrapped_middleware_class, *args, &blk) else use_without_mmtrix(middleware_class, *args, &blk) end end