Class: ILove::Tracing::OutgoingRequests::FaradayTraceMiddleware

Inherits:
Faraday::Middleware
  • Object
show all
Defined in:
lib/ilove/tracing/outgoing_requests.rb

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/ilove/tracing/outgoing_requests.rb', line 7

def call(env)
  scope = OpenTracing.start_active_span 'outgoing http request',
                                        child_of: OpenTracing.active_span,
                                        tags: { url: env.url, method: env.method }

  OpenTracing.inject scope.span.context, OpenTracing::FORMAT_RACK, env[:request_headers]

  @app.call(env).on_complete do
    scope.close
  end
end