Sha256: b556b3eb7e58cd11c53b05f67636fa3e0dc64e828307f7aebb08e795dc139a5a

Contents?: true

Size: 787 Bytes

Versions: 2

Compression:

Stored size: 787 Bytes

Contents

# frozen_string_literal: true

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

module OpenTelemetry
  module Adapters
    module Excon
      # The Adapter class contains logic to detect and install the Excon
      # instrumentation adapter
      class Adapter < OpenTelemetry::Instrumentation::Adapter
        install do |_config|
          require_dependencies
          add_middleware
        end

        present do
          defined?(::Excon)
        end

        private

        def require_dependencies
          require_relative 'middlewares/tracer_middleware'
        end

        def add_middleware
          ::Excon.defaults[:middlewares] =
            Middlewares::TracerMiddleware.around_default_stack
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
opentelemetry-adapters-excon-0.4.0 lib/opentelemetry/adapters/excon/adapter.rb
opentelemetry-adapters-excon-0.3.0 lib/opentelemetry/adapters/excon/adapter.rb