Sha256: c4fdccd7eeec7e04f36848f42cf2cacdf177360f9c6a1493545f45fbc6a3e181

Contents?: true

Size: 800 Bytes

Versions: 30

Compression:

Stored size: 800 Bytes

Contents

require 'net/http'

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

      def dependencies_present?
        Appsignal.config[:instrument_net_http]
      end

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

          def request(request, body=nil, &block)
            ActiveSupport::Notifications.instrument(
              'request.net_http',
              :protocol => use_ssl? ? 'https' : 'http',
              :domain   => request['host'] || self.address,
              :path     => request.path,
              :method   => request.method
            ) do
              request_without_appsignal(request, body, &block)
            end
          end
        end
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
appsignal-1.0.1 lib/appsignal/hooks/net_http.rb
appsignal-1.0.0 lib/appsignal/hooks/net_http.rb
appsignal-1.0.0.rc.1 lib/appsignal/hooks/net_http.rb
appsignal-0.12.rc.14 lib/appsignal/hooks/net_http.rb
appsignal-0.12.rc.13 lib/appsignal/hooks/net_http.rb
appsignal-0.12.rc.12 lib/appsignal/hooks/net_http.rb
appsignal-0.12.rc.11 lib/appsignal/hooks/net_http.rb
appsignal-0.12.rc.10 lib/appsignal/hooks/net_http.rb
appsignal-0.12.rc.9 lib/appsignal/hooks/net_http.rb
appsignal-0.12.rc.8 lib/appsignal/hooks/net_http.rb