Sha256: 84cdd30d62e715bc1327a64d85ed26c444b40d1515324036d667ad6b07145970

Contents?: true

Size: 785 Bytes

Versions: 1

Compression:

Stored size: 785 Bytes

Contents

# frozen_string_literal: true

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

module OpenTelemetry
  module Instrumentation
    module HTTP
      module Patches
        # Module to prepend to HTTP::Connection for instrumentation
        module Connection
          def initialize(req, options)
            attributes = OpenTelemetry::Common::HTTP::ClientContext.attributes.merge(
              'net.peer.name' => req.uri.host,
              'net.peer.port' => req.uri.port
            )

            tracer.in_span('HTTP CONNECT', attributes: attributes) do
              super
            end
          end

          private

          def tracer
            HTTP::Instrumentation.instance.tracer
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-http-0.19.3 lib/opentelemetry/instrumentation/http/patches/connection.rb