Class: Faraday::Aws::XRay::Middleware
- Inherits:
-
Middleware
- Object
- Middleware
- Faraday::Aws::XRay::Middleware
- Defined in:
- lib/faraday/aws/xray/middleware.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ Middleware
constructor
A new instance of Middleware.
Constructor Details
#initialize(app, options = {}) ⇒ Middleware
Returns a new instance of Middleware.
7 8 9 10 |
# File 'lib/faraday/aws/xray/middleware.rb', line 7 def initialize(app, = {}) super(app) @name = [:name] || 'external_http_request' end |
Instance Method Details
#call(env) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/faraday/aws/xray/middleware.rb', line 12 def call(env) ::XRay.recorder.capture(@name) do |_segment| ::XRay.recorder.capture(env.url.to_s) do |subsegment| add_request_data(subsegment, env) response = @app.call(env) add_response_data(subsegment, response) response end end end |