lib/opentelemetry/instrumentation/faraday/instrumentation.rb in opentelemetry-instrumentation-faraday-0.24.4 vs lib/opentelemetry/instrumentation/faraday/instrumentation.rb in opentelemetry-instrumentation-faraday-0.24.5

- old
+ new

@@ -25,20 +25,25 @@ private def require_dependencies require_relative 'middlewares/tracer_middleware' + require_relative 'patches/connection' require_relative 'patches/rack_builder' end def register_tracer_middleware ::Faraday::Middleware.register_middleware( open_telemetry: Middlewares::TracerMiddleware ) end def use_middleware_by_default - ::Faraday::RackBuilder.prepend(Patches::RackBuilder) + if Gem::Version.new(::Faraday::VERSION) >= Gem::Version.new('1') + ::Faraday::Connection.prepend(Patches::Connection) + else + ::Faraday::RackBuilder.prepend(Patches::RackBuilder) + end end end end end end