Class: Datadog::Contrib::Faraday::Middleware
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- Datadog::Contrib::Faraday::Middleware
- Includes:
- HttpAnnotationHelper, Ext::DistributedTracing
- Defined in:
- lib/ddtrace/contrib/faraday/middleware.rb
Overview
Middleware implements a faraday-middleware for ddtrace instrumentation
Constant Summary
Constants included from Ext::DistributedTracing
Ext::DistributedTracing::B3_HEADER_SAMPLED, Ext::DistributedTracing::B3_HEADER_SINGLE, Ext::DistributedTracing::B3_HEADER_SPAN_ID, Ext::DistributedTracing::B3_HEADER_TRACE_ID, Ext::DistributedTracing::GRPC_METADATA_ORIGIN, Ext::DistributedTracing::GRPC_METADATA_PARENT_ID, Ext::DistributedTracing::GRPC_METADATA_SAMPLING_PRIORITY, Ext::DistributedTracing::GRPC_METADATA_TRACE_ID, Ext::DistributedTracing::HTTP_HEADER_ORIGIN, Ext::DistributedTracing::HTTP_HEADER_PARENT_ID, Ext::DistributedTracing::HTTP_HEADER_SAMPLING_PRIORITY, Ext::DistributedTracing::HTTP_HEADER_TRACE_ID, Ext::DistributedTracing::ORIGIN_KEY, Ext::DistributedTracing::PROPAGATION_EXTRACT_STYLE_ENV_OLD, Ext::DistributedTracing::PROPAGATION_INJECT_STYLE_ENV_OLD, Ext::DistributedTracing::PROPAGATION_STYLE_B3, Ext::DistributedTracing::PROPAGATION_STYLE_B3_SINGLE_HEADER, Ext::DistributedTracing::PROPAGATION_STYLE_DATADOG, Ext::DistributedTracing::PROPAGATION_STYLE_EXTRACT_ENV, Ext::DistributedTracing::PROPAGATION_STYLE_INJECT_ENV, Ext::DistributedTracing::SAMPLING_PRIORITY_KEY
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.
19 20 21 22 |
# File 'lib/ddtrace/contrib/faraday/middleware.rb', line 19 def initialize(app, = {}) super(app) @options = end |
Instance Method Details
#call(env) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ddtrace/contrib/faraday/middleware.rb', line 24 def call(env) # Resolve configuration settings to use for this request. # Do this once to reduce expensive regex calls. = (env) [:tracer].trace(Ext::SPAN_REQUEST) do |span| annotate!(span, env, ) propagate!(span, env) if [:distributed_tracing] && [:tracer].enabled app.call(env).on_complete { |resp| handle_response(span, resp, ) } end end |