module OneApm::Agent::Instrumentation::RackBuilder

Public Instance Methods

_check_for_late_instrumentation(app) click to toggle source
# 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) click to toggle source
# 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() click to toggle source

defered detection to avoid something later required

# 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) click to toggle source
# 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