module NewRelic::Agent::Instrumentation::RackBuilder
Public Instance Methods
run_with_newrelic(app, *args)
click to toggle source
# File lib/new_relic/agent/instrumentation/rack.rb, line 129 def run_with_newrelic(app, *args) if ::NewRelic::Agent::Instrumentation::RackHelpers.middleware_instrumentation_enabled? wrapped_app = ::NewRelic::Agent::Instrumentation::MiddlewareProxy.wrap(app, true) run_without_newrelic(wrapped_app, *args) else run_without_newrelic(app, *args) end end
to_app_with_newrelic_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/new_relic/agent/instrumentation/rack.rb, line 153 def to_app_with_newrelic_deferred_dependency_detection unless self.class._nr_deferred_detection_ran NewRelic::Agent.logger.info "Doing deferred dependency-detection before Rack startup" DependencyDetection.detect! self.class._nr_deferred_detection_ran = true end result = to_app_without_newrelic ::NewRelic::Agent::Instrumentation::RackHelpers.check_for_late_instrumentation(result) result end
use_with_newrelic(middleware_class, *args, &blk)
click to toggle source
# File lib/new_relic/agent/instrumentation/rack.rb, line 138 def use_with_newrelic(middleware_class, *args, &blk) if ::NewRelic::Agent::Instrumentation::RackHelpers.middleware_instrumentation_enabled? wrapped_middleware_class = ::NewRelic::Agent::Instrumentation::MiddlewareProxy.for_class(middleware_class) use_without_newrelic(wrapped_middleware_class, *args, &blk) else use_without_newrelic(middleware_class, *args, &blk) end end