class ILove::Tracing::OutgoingRequests::FaradayTraceMiddleware

Public Instance Methods

call(env) click to toggle source
# 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