Sha256: 6c2edf2653fa11457188dfcc0cd2ce38d20ef235cd506eb2eecb95d1bc2fee49

Contents?: true

Size: 627 Bytes

Versions: 2

Compression:

Stored size: 627 Bytes

Contents

# frozen_string_literal: true

# Copyright 2019 OpenTelemetry Authors
#
# SPDX-License-Identifier: Apache-2.0

module OpenTelemetry
  module Adapters
    module Faraday
      module Patches
        # Module to be prepended to force Faraday to use the middleware by
        # default so the user doesn't have to call `use` for every connection.
        module RackBuilder
          def adapter(*args)
            use(:open_telemetry) unless @handlers.any? do |handler|
              handler.klass == Faraday::Middlewares::TracerMiddleware
            end

            super
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
opentelemetry-adapters-faraday-0.4.0 lib/opentelemetry/adapters/faraday/patches/rack_builder.rb
opentelemetry-adapters-faraday-0.3.0 lib/opentelemetry/adapters/faraday/patches/rack_builder.rb