The Instrumentation middleware allows to instrument requests using different tools. Options for this middleware include the instrumentation name and the instrumenter you want to use. They default to request.faraday and ActiveSupport::Notifications respectively, but you can provide your own:

conn = do |f|
  f.request :instrumentation, name: 'custom_name', instrumenter: MyInstrumenter

Example Usage

The Instrumentation middleware will use ActiveSupport::Notifications by default as instrumenter, allowing you to subscribe to the default event name and instrument requests:

conn ='') do |f|
  f.request :instrumentation

ActiveSupport::Notifications.subscribe('request.faraday') do |name, starts, ends, _, env|
  url = env[:url]
  http_method = env[:method].to_s.upcase
  duration = ends - starts
  $stdout.puts '[%s] %s %s (%.3f s)' % [, http_method, url.request_uri, duration]

conn.get('/search', { a: 1, b: 2 })
#=> [] GET /search?a=1&b=2 (0.529 s)