Where you initialize the Faraday
connection, you can pass things through to the underlying adapter. For example, I use this behavior in one of my clients, albeit with Excon
instead of Net::HTTP
, but you should be able to adapt:
excon_options = {}
excon_options.merge!(instrumentor: instrumentor) if instrumentor
@connection = Faraday::Connection.new(url: url) do |builder|
builder.adapter :excon, excon_options
end
The excon_options
hash in this case is the format of a hash that I would pass to the Excon
connection object if I weren't using Faraday
. You should be able to do something similar with Net::HTTP