Class: Datadog::Tracing::Contrib::Faraday::Middleware
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- Datadog::Tracing::Contrib::Faraday::Middleware
- Includes:
- HttpAnnotationHelper
- Defined in:
- lib/datadog/tracing/contrib/faraday/middleware.rb
Overview
Middleware implements a faraday-middleware for ddtrace instrumentation
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ Middleware
constructor
A new instance of Middleware.
Methods included from HttpAnnotationHelper
Constructor Details
#initialize(app, options = {}) ⇒ Middleware
Returns a new instance of Middleware.
17 18 19 20 |
# File 'lib/datadog/tracing/contrib/faraday/middleware.rb', line 17 def initialize(app, = {}) super(app) @options = end |
Instance Method Details
#call(env) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/datadog/tracing/contrib/faraday/middleware.rb', line 22 def call(env) # Resolve configuration settings to use for this request. # Do this once to reduce expensive regex calls. = (env) Tracing.trace(Ext::SPAN_REQUEST, on_error: [:on_error]) do |span, trace| annotate!(span, env, ) propagate!(trace, span, env) if [:distributed_tracing] && Tracing.enabled? app.call(env).on_complete { |resp| handle_response(span, resp, ) } end end |