Class: Faraday::Request::Instrumentation
- Inherits:
- 
      Middleware
      
        - Object
- Middleware
- Faraday::Request::Instrumentation
 
- Defined in:
- lib/faraday/request/instrumentation.rb
Overview
Middleware for instrumenting Requests.
Constant Summary collapse
- Options =
          Options class used in Request::Instrumentation class. 
- Faraday::Options.new(:name, :instrumenter) do remove_method :name # @return [String] def name self[:name] ||= 'request.faraday' end remove_method :instrumenter # @return [Class] def instrumenter self[:instrumenter] ||= ActiveSupport::Notifications end end 
Constants inherited from Middleware
Middleware::DEFAULT_OPTIONS, Middleware::LOCK
Instance Attribute Summary
Attributes inherited from Middleware
Instance Method Summary collapse
- #call(env) ⇒ Object
- 
  
    
      #initialize(app, options = nil)  ⇒ Instrumentation 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    Instruments requests using Active Support. 
Methods inherited from Middleware
#close, default_options, default_options=
Methods included from MiddlewareRegistry
#lookup_middleware, #register_middleware, #registered_middleware, #unregister_middleware
Constructor Details
#initialize(app, options = nil) ⇒ Instrumentation
Instruments requests using Active Support.
Measures time spent only for synchronous requests.
| 42 43 44 45 46 | # File 'lib/faraday/request/instrumentation.rb', line 42 def initialize(app, = nil) super(app) @name, @instrumenter = Options.from() .values_at(:name, :instrumenter) end | 
Instance Method Details
#call(env) ⇒ Object
| 49 50 51 52 53 | # File 'lib/faraday/request/instrumentation.rb', line 49 def call(env) @instrumenter.instrument(@name, env) do @app.call(env) end end |