Sha256: b0c248e354bfeb2fbb5084987751754be2ddd647f944cb8dc9e65b9d3063390a
Contents?: true
Size: 1.1 KB
Versions: 2
Compression:
Stored size: 1.1 KB
Contents
module Honeybadger module Integrations module NetHttp module Instrumentation def self.included(base) base.send(:alias_method, :request_without_honeybadger, :request) base.send(:alias_method, :request, :request_with_honeybadger) end def request_with_honeybadger(*args, &block) request = args[0] uri = request.path.match(%r{https?://}) ? URI(request.path) : URI("http#{use_ssl? ? 's' : ''}://#{address}:#{port}#{request.path}") if uri.host.match("honeybadger.io") return request_without_honeybadger(*args, &block) end ActiveSupport::Notifications.instrument("net_http.request", { :uri => uri, :method => request.method }) do request_without_honeybadger(*args, &block) end end end end end Dependency.register do requirement { defined?(::ActiveSupport::Notifications) } requirement { defined?(::Net::HTTP) } requirement { defined?(::Honeybadger::Monitor) } injection { ::Net::HTTP.send(:include, Integrations::NetHttp::Instrumentation) } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
honeybadger-1.16.1 | lib/honeybadger/integrations/net_http.rb |
honeybadger-1.16.0 | lib/honeybadger/integrations/net_http.rb |