Sha256: be1ba00bcbd53d387e0ba40519513b6f459a89aea4439c49c717c24623eadf08

Contents?: true

Size: 912 Bytes

Versions: 6

Compression:

Stored size: 912 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

        option :span_name_formatter, default: nil, validate: :callable

        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

6 entries across 6 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-http-0.23.5 lib/opentelemetry/instrumentation/http/instrumentation.rb
opentelemetry-instrumentation-http-0.23.4 lib/opentelemetry/instrumentation/http/instrumentation.rb
opentelemetry-instrumentation-http-0.23.3 lib/opentelemetry/instrumentation/http/instrumentation.rb
opentelemetry-instrumentation-http-0.23.2 lib/opentelemetry/instrumentation/http/instrumentation.rb
opentelemetry-instrumentation-http-0.23.1 lib/opentelemetry/instrumentation/http/instrumentation.rb
opentelemetry-instrumentation-http-0.23.0 lib/opentelemetry/instrumentation/http/instrumentation.rb