Sha256: 3fceda719d3f18267e63b1f4a1a9f04bf645759e9363418ef01bbd2314c22b05

Contents?: true

Size: 840 Bytes

Versions: 5

Compression:

Stored size: 840 Bytes

Contents

# frozen_string_literal: true

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

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

        present do
          !(defined?(::HTTP::Client).nil? || defined?(::HTTP::Connection).nil?)
        end

        def patch
          ::HTTP::Client.prepend(Patches::Client)
          ::HTTP::Connection.prepend(Patches::Connection)
        end

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-http-0.22.0 lib/opentelemetry/instrumentation/http/instrumentation.rb
opentelemetry-instrumentation-http-0.21.0 lib/opentelemetry/instrumentation/http/instrumentation.rb
opentelemetry-instrumentation-http-0.20.0 lib/opentelemetry/instrumentation/http/instrumentation.rb
opentelemetry-instrumentation-http-0.19.6 lib/opentelemetry/instrumentation/http/instrumentation.rb
opentelemetry-instrumentation-http-0.19.5 lib/opentelemetry/instrumentation/http/instrumentation.rb