Sha256: 582950f394a44f83a78cbd7131d34c28a282744c64105d10cb5666371595fb8a

Contents?: true

Size: 1.19 KB

Versions: 10

Compression:

Stored size: 1.19 KB

Contents

# frozen_string_literal: true

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

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

          present do
            defined?(::Net::HTTP)
          end

          ## Supported configuration keys for the install config hash:
          #
          # untraced_hosts: if a request's address matches any of the `String`
          #   or `Regexp` in this array, the instrumentation will not record a
          #   `kind = :client` representing the request and will not propagate
          #   context in the request.
          option :untraced_hosts, default: [], validate: :array

          private

          def require_dependencies
            require_relative 'patches/instrumentation'
          end

          def patch
            ::Net::HTTP.prepend(Patches::Instrumentation)
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-net_http-0.22.8 lib/opentelemetry/instrumentation/net/http/instrumentation.rb
opentelemetry-instrumentation-net_http-0.22.7 lib/opentelemetry/instrumentation/net/http/instrumentation.rb
opentelemetry-instrumentation-net_http-0.22.6 lib/opentelemetry/instrumentation/net/http/instrumentation.rb
opentelemetry-instrumentation-net_http-0.22.4 lib/opentelemetry/instrumentation/net/http/instrumentation.rb
opentelemetry-instrumentation-net_http-0.22.3 lib/opentelemetry/instrumentation/net/http/instrumentation.rb
opentelemetry-instrumentation-net_http-0.22.2 lib/opentelemetry/instrumentation/net/http/instrumentation.rb
opentelemetry-instrumentation-net_http-0.22.1 lib/opentelemetry/instrumentation/net/http/instrumentation.rb
opentelemetry-instrumentation-net_http-0.22.0 lib/opentelemetry/instrumentation/net/http/instrumentation.rb
opentelemetry-instrumentation-net_http-0.21.1 lib/opentelemetry/instrumentation/net/http/instrumentation.rb
opentelemetry-instrumentation-net_http-0.21.0 lib/opentelemetry/instrumentation/net/http/instrumentation.rb