Sha256: b323e68927a3f9d2c33f2cbc4e04b32a06d2e32b56c5012b5e9e24a473b148ec

Contents?: true

Size: 842 Bytes

Versions: 20

Compression:

Stored size: 842 Bytes

Contents

# frozen_string_literal: true

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

require 'opentelemetry'

module OpenTelemetry
  module Instrumentation
    module HttpClient
      # The Instrumentation class contains logic to detect and install the HttpClient instrumentation
      class Instrumentation < OpenTelemetry::Instrumentation::Base
        install do |_config|
          require_dependencies
          patch
        end

        present do
          defined?(::HTTPClient)
        end

        private

        def patch
          ::HTTPClient.prepend(Patches::Client)
          ::HTTPClient::Session.prepend(Patches::Session)
        end

        def require_dependencies
          require_relative 'patches/client'
          require_relative 'patches/session'
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-http_client-0.22.8 lib/opentelemetry/instrumentation/http_client/instrumentation.rb
opentelemetry-instrumentation-http_client-0.22.7 lib/opentelemetry/instrumentation/http_client/instrumentation.rb
opentelemetry-instrumentation-http_client-0.22.6 lib/opentelemetry/instrumentation/http_client/instrumentation.rb
opentelemetry-instrumentation-http_client-0.22.4 lib/opentelemetry/instrumentation/http_client/instrumentation.rb
opentelemetry-instrumentation-http_client-0.22.3 lib/opentelemetry/instrumentation/http_client/instrumentation.rb
opentelemetry-instrumentation-http_client-0.22.2 lib/opentelemetry/instrumentation/http_client/instrumentation.rb
opentelemetry-instrumentation-http_client-0.22.1 lib/opentelemetry/instrumentation/http_client/instrumentation.rb
opentelemetry-instrumentation-http_client-0.22.0 lib/opentelemetry/instrumentation/http_client/instrumentation.rb
opentelemetry-instrumentation-http_client-0.21.0 lib/opentelemetry/instrumentation/http_client/instrumentation.rb
opentelemetry-instrumentation-http_client-0.20.0 lib/opentelemetry/instrumentation/http_client/instrumentation.rb
opentelemetry-instrumentation-http_client-0.19.5 lib/opentelemetry/instrumentation/http_client/instrumentation.rb
opentelemetry-instrumentation-http_client-0.19.4 lib/opentelemetry/instrumentation/http_client/instrumentation.rb
opentelemetry-instrumentation-http_client-0.19.3 lib/opentelemetry/instrumentation/http_client/instrumentation.rb
opentelemetry-instrumentation-http_client-0.19.2 lib/opentelemetry/instrumentation/http_client/instrumentation.rb
opentelemetry-instrumentation-http_client-0.19.1 lib/opentelemetry/instrumentation/http_client/instrumentation.rb
opentelemetry-instrumentation-http_client-0.19.0 lib/opentelemetry/instrumentation/http_client/instrumentation.rb
opentelemetry-instrumentation-http_client-0.18.0 lib/opentelemetry/instrumentation/http_client/instrumentation.rb
opentelemetry-instrumentation-http_client-0.17.0 lib/opentelemetry/instrumentation/http_client/instrumentation.rb
opentelemetry-instrumentation-http_client-0.16.0 lib/opentelemetry/instrumentation/http_client/instrumentation.rb
opentelemetry-instrumentation-http_client-0.15.0 lib/opentelemetry/instrumentation/http_client/instrumentation.rb