Sha256: 17177a537132568fe4be511dc3b6d82fa37b9c7ca17e330f555412d9c2a04267

Contents?: true

Size: 803 Bytes

Versions: 2

Compression:

Stored size: 803 Bytes

Contents

# frozen_string_literal: true

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

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

        present do
          defined?(::Ethon::Easy)
        end

        private

        def require_dependencies
          require_relative 'patches/easy'
          require_relative 'patches/multi'
        end

        def add_patches
          ::Ethon::Easy.prepend(Patches::Easy)
          ::Ethon::Multi.prepend(Patches::Multi)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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