Sha256: 4eaf5154069cd91457917c308ca88a6ba2a557a9a0fe41193e72c51b8b1c748f

Contents?: true

Size: 783 Bytes

Versions: 2

Compression:

Stored size: 783 Bytes

Contents

# frozen_string_literal: true

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

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

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

          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

2 entries across 2 versions & 1 rubygems

Version Path
opentelemetry-adapters-net_http-0.4.0 lib/opentelemetry/adapters/net/http/adapter.rb
opentelemetry-adapters-net_http-0.3.0 lib/opentelemetry/adapters/net/http/adapter.rb