Sha256: 634be7ed26e7bfa01ad0bb526e5cba48caf2c8eb10f925ab729009078e9e3cc6

Contents?: true

Size: 704 Bytes

Versions: 27

Compression:

Stored size: 704 Bytes

Contents

require 'net/http'

module Appsignal
  class Hooks
    class NetHttpHook < Appsignal::Hooks::Hook
      register :net_http

      def dependencies_present?
        Appsignal.config && Appsignal.config[:instrument_net_http]
      end

      def install
        Net::HTTP.class_eval do
          alias request_without_appsignal request

          def request(request, body=nil, &block)
            Appsignal.instrument(
              'request.net_http',
              "#{request.method} #{use_ssl? ? 'https' : 'http'}://#{request['host'] || self.address}"
            ) do
              request_without_appsignal(request, body, &block)
            end
          end
        end
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
appsignal-2.0.6 lib/appsignal/hooks/net_http.rb
appsignal-2.0.5 lib/appsignal/hooks/net_http.rb
appsignal-2.0.5.beta.1 lib/appsignal/hooks/net_http.rb
appsignal-2.1.0.alpha.3 lib/appsignal/hooks/net_http.rb
appsignal-2.1.0.alpha.2 lib/appsignal/hooks/net_http.rb
appsignal-2.1.0.alpha.1 lib/appsignal/hooks/net_http.rb
appsignal-2.0.4 lib/appsignal/hooks/net_http.rb
appsignal-2.0.3 lib/appsignal/hooks/net_http.rb
appsignal-2.0.2 lib/appsignal/hooks/net_http.rb
appsignal-2.0.1 lib/appsignal/hooks/net_http.rb
appsignal-2.0.0 lib/appsignal/hooks/net_http.rb
appsignal-2.0.0.beta.1 lib/appsignal/hooks/net_http.rb
appsignal-1.4.0.beta.1 lib/appsignal/hooks/net_http.rb
appsignal-1.3.6 lib/appsignal/hooks/net_http.rb
appsignal-1.3.6.beta.1 lib/appsignal/hooks/net_http.rb
appsignal-1.3.5 lib/appsignal/hooks/net_http.rb
appsignal-1.3.5.beta.1 lib/appsignal/hooks/net_http.rb
appsignal-1.3.4 lib/appsignal/hooks/net_http.rb
appsignal-1.3.3 lib/appsignal/hooks/net_http.rb
appsignal-1.4.0.alpha.2 lib/appsignal/hooks/net_http.rb