Module: NetworkResiliency::Adapter::HTTP::Instrumentation
- Defined in:
- lib/network_resiliency/adapter/http.rb
Instance Method Summary collapse
Instance Method Details
#connect ⇒ Object
106 107 108 109 110 |
# File 'lib/network_resiliency/adapter/http.rb', line 106 def connect return super unless NetworkResiliency.enabled?(:http) with_resilience(:connect, address, true) { super } end |
#transport_request(req, &block) ⇒ Object
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/network_resiliency/adapter/http.rb', line 112 def transport_request(req, &block) return super unless NetworkResiliency.enabled?(:http) # strip query params path = URI.parse(req.path).path destination = [ address, req.method.downcase, normalize_path(path), ].join(":") idepotent = Net::HTTP::IDEMPOTENT_METHODS_.include?(req.method) with_resilience(:request, destination, idepotent) do |timeout| # send timeout via headers req[REQUEST_TIMEOUT_HEADER] = timeout super end end |