Class: Faraday::Request::Instrumentation

### Home Classes Methods

### In Files

- lib/faraday/request/instrumentation.rb

### Parent

Faraday::Middleware

### Namespace

- CLASS Faraday::Request::Instrumentation::Options

### Methods

- ::new
- #call

### Class/Module Index

Quicksearch

- Faraday
- Faraday::Adapter
- Faraday::Adapter::EMHttp
- Faraday::Adapter::EMHttp::Manager
- Faraday::Adapter::EMHttp::Options
- Faraday::Adapter::EMSynchrony
- Faraday::Adapter::EMSynchrony::ParallelManager
- Faraday::Adapter::Excon
- Faraday::Adapter::HTTPClient
- Faraday::Adapter::NetHttp
- Faraday::Adapter::NetHttpPersistent
- Faraday::Adapter::Parallelism
- Faraday::Adapter::Patron
- Faraday::Adapter::Rack
- Faraday::Adapter::Test
- Faraday::Adapter::Test::Stub
- Faraday::Adapter::Test::Stubs
- Faraday::Adapter::Test::Stubs::NotFound
- Faraday::Adapter::Typhoeus
- Faraday::AutoloadHelper
- Faraday::ClientError
- Faraday::CompositeReadIO
- Faraday::Connection
- Faraday::ConnectionFailed
- Faraday::ConnectionOptions
- Faraday::Env
- Faraday::Error
- Faraday::FlatParamsEncoder
- Faraday::Middleware
- Faraday::MiddlewareRegistry
- Faraday::MissingDependency
- Faraday::NestedParamsEncoder
- Faraday::Options
- Faraday::ParsingError
- Faraday::ProxyOptions
- Faraday::RackBuilder
- Faraday::RackBuilder::Handler
- Faraday::RackBuilder::StackLocked
- Faraday::Request
- Faraday::Request::Authorization
- Faraday::Request::BasicAuthentication
- Faraday::Request::Instrumentation
- Faraday::Request::Instrumentation::Options
- Faraday::Request::Multipart
- Faraday::Request::Retry
- Faraday::Request::Retry::Options
- Faraday::Request::TokenAuthentication
- Faraday::Request::UrlEncoded
- Faraday::RequestOptions
- Faraday::ResourceNotFound
- Faraday::Response
- Faraday::Response::Logger
- Faraday::Response::Middleware
- Faraday::Response::RaiseError
- Faraday::SSLError
- Faraday::SSLOptions
- Faraday::TimeoutError
- Faraday::Utils
- Faraday::Utils::Headers
- Faraday::Utils::ParamsHash
- EmHttpSslPatch
- Object

No matching classes.

# Faraday::Request::Instrumentation

### Public Class Methods

new(app, options = nil) click to toggle source

Public: Instruments requests using Active Support.

Measures time spent only for synchronous requests.

Examples

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

    # File lib/faraday/request/instrumentation.rb, line 25
    def initialize(app, options = nil)
      super(app)
      @name, @instrumenter = Options.from(options).values_at(:name, :instrumenter)
    end

### Public Instance Methods

call(env) click to toggle source

    # File lib/faraday/request/instrumentation.rb, line 30
    def call(env)
      @instrumenter.instrument(@name, env) do
        @app.call(env)
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.