Sha256: c9dc02a9671d1d71b21bdadb996fd37c2351a55d1266cd9c569b37a51ae426a8

Contents?: true

Size: 958 Bytes

Versions: 6

Compression:

Stored size: 958 Bytes

Contents

module Instana
  module Instrumentation
    module RestClientRequest
      def self.included(klass)
        if klass.method_defined?(:execute)
          klass.class_eval do
            alias execute_without_instana execute
            alias execute execute_with_instana
          end
        end
      end

      def execute_with_instana & block
        # Since RestClient uses net/http under the covers, we just
        # provide span visibility here.  HTTP related KVs are reported
        # in the Net::HTTP instrumentation
        ::Instana.tracer.log_entry(:'rest-client')

        execute_without_instana(&block)
      rescue => e
        ::Instana.tracer.log_error(e)
        raise
      ensure
        ::Instana.tracer.log_exit(:'rest-client')
      end

    end
  end
end

if defined?(::RestClient::Request)
  ::Instana.logger.warn "Instrumenting RestClient"
  ::RestClient::Request.send(:include, ::Instana::Instrumentation::RestClientRequest)
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
instana-1.0.2 lib/instana/instrumentation/rest-client.rb
instana-1.0.1 lib/instana/instrumentation/rest-client.rb
instana-0.15.0 lib/instana/instrumentation/rest-client.rb
instana-0.14.2 lib/instana/instrumentation/rest-client.rb
instana-0.14.0 lib/instana/instrumentation/rest-client.rb
instana-0.13.1 lib/instana/instrumentation/rest-client.rb