Sha256: 0760c40e3068eaa74c85420c9e0e6bb20ecc219031332a05db141e5f76028825

Contents?: true

Size: 738 Bytes

Versions: 2

Compression:

Stored size: 738 Bytes

Contents

# frozen_string_literal: true

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

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

        present do
          defined?(::RestClient)
        end

        private

        def require_dependencies
          require_relative 'patches/request'
        end

        def patch_request
          ::RestClient::Request.prepend(Patches::Request)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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