Sha256: 76f7ebc4f2b99811d621b24b3642b44aaf944152a35ea31cea18efea72a34504

Contents?: true

Size: 1017 Bytes

Versions: 39

Compression:

Stored size: 1017 Bytes

Contents

# encoding: utf-8

LibraryDetection.defer do
  named :net_http

  depends_on do
    defined?(Net) && defined?(Net::HTTP)
  end

  executes do
    OneApm::Manager.logger.info 'Installing Net instrumentation'
    require 'one_apm/agent/cross_app/cross_app_tracing'
    require 'one_apm/support/http_clients/net_http_wrappers'
  end

  executes do
    class Net::HTTP
      def request_with_oneapm_trace(request, *args, &block)
        wrapped_request = OneApm::Support::HTTPClients::NetHTTPRequest.new(self, request)

        OneApm::Agent::CrossAppTracing.tl_trace_http_request( wrapped_request ) do
          # RUBY-1244 Disable further tracing in request to avoid double
          # counting if connection wasn't started (which calls request again).
          OneApm::Manager.disable_all_tracing do
            request_without_oneapm_trace( request, *args, &block )
          end
        end
      end

      alias request_without_oneapm_trace request
      alias request request_with_oneapm_trace
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

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