Sha256: 7586c644022a150811e837dfdaf333dc9bf0158108c059538fe97d0331669664

Contents?: true

Size: 823 Bytes

Versions: 7

Compression:

Stored size: 823 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) && Gem.loaded_specs['http']).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

7 entries across 7 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-http-0.19.4 lib/opentelemetry/instrumentation/http/instrumentation.rb
opentelemetry-instrumentation-http-0.19.3 lib/opentelemetry/instrumentation/http/instrumentation.rb
opentelemetry-instrumentation-http-0.19.2 lib/opentelemetry/instrumentation/http/instrumentation.rb
opentelemetry-instrumentation-http-0.19.1 lib/opentelemetry/instrumentation/http/instrumentation.rb
opentelemetry-instrumentation-http-0.19.0 lib/opentelemetry/instrumentation/http/instrumentation.rb
opentelemetry-instrumentation-http-0.18.0 lib/opentelemetry/instrumentation/http/instrumentation.rb
opentelemetry-instrumentation-http-0.17.0 lib/opentelemetry/instrumentation/http/instrumentation.rb