Sha256: a5549c180e4c32f01c465181914017b923a5c39b886857039a7c51729840df4c

Contents?: true

Size: 1.06 KB

Versions: 42

Compression:

Stored size: 1.06 KB

Contents

module OneApm
  module Agent
    module Instrumentation
      module Rack
        include TransactionBase

        def oneapm_request_headers(_)
          @oneapm_request.env
        end

        def call_with_oneapm(*args)
          @oneapm_request = ::Rack::Request.new(args.first)
          perform_action_with_oneapm_trace(:category => :middleware, :request => @oneapm_request) do
            result = call_without_oneapm(*args)
            # Ignore cascaded calls
            Transaction.abort_transaction! if result.first == 404
            result
          end
        end

        def self.included middleware
          middleware.class_eval do
            alias call_without_oneapm call
            alias call call_with_oneapm
          end
        end

        def self.extended middleware
          middleware.class_eval do
            class << self
              alias call_without_oneapm call
              alias call call_with_oneapm
            end
          end
        end

        def _oa_has_middleware_tracing
          true
        end

      end
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
oneapm_rpm-1.4.2 lib/one_apm/inst/rack/rack.rb
oneapm_rpm-1.4.1 lib/one_apm/inst/rack/rack.rb
oneapm_rpm-1.4.0 lib/one_apm/inst/rack/rack.rb
oneapm_rpm-1.3.7 lib/one_apm/inst/rack/rack.rb
oneapm_rpm-1.3.7.rc1 lib/one_apm/inst/rack/rack.rb
oneapm_rpm-1.3.6 lib/one_apm/inst/rack/rack.rb
oneapm_rpm-1.3.6.rc1 lib/one_apm/inst/rack/rack.rb
oneapm_rpm-1.3.5 lib/one_apm/inst/rack/rack.rb
oneapm_rpm-1.3.5.rc1 lib/one_apm/inst/rack/rack.rb
oneapm_rpm-1.3.4 lib/one_apm/inst/rack/rack.rb
oneapm_rpm-1.3.4.rc1 lib/one_apm/inst/rack/rack.rb
oneapm_rpm-1.3.3 lib/one_apm/inst/rack/rack.rb
oneapm_rpm-1.3.3.rc1 lib/one_apm/inst/rack/rack.rb
oneapm_rpm-1.3.2 lib/one_apm/inst/rack/rack.rb
oneapm_rpm-1.3.2.rc1 lib/one_apm/inst/rack/rack.rb
oneapm_rpm-1.3.1 lib/one_apm/inst/rack/rack.rb
oneapm_rpm-1.3.1.rc1 lib/one_apm/inst/rack/rack.rb
oneapm_rpm-1.3.0 lib/one_apm/inst/rack/rack.rb
oneapm_rpm-1.3.0.rc1 lib/one_apm/inst/rack/rack.rb
oneapm_rpm-1.2.9 lib/one_apm/inst/rack/rack.rb