Sha256: 1c39af59f4663fe9acedf0454673b0a04ef7c857379dddd00b7bc5e99c4d4de4
Contents?: true
Size: 852 Bytes
Versions: 1
Compression:
Stored size: 852 Bytes
Contents
require_relative 'faraday_middleware' module ILove module Tracing module OutgoingRequests class FaradayTraceMiddleware < Faraday::Middleware 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 end def self.setup(cfg) raise 'Cannot trace outgoing request without Faraday' unless defined?(Faraday) ILove::Tracing::FaradayMiddleware.add_active_middleware FaradayTraceMiddleware end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ilove-tracing-0.2.0 | lib/ilove/tracing/outgoing_requests.rb |