Sha256: 51c91dda7fb4e5f2cc6c66f975f0feb71a7f83bac3a6b4f6a69bf2b72547eb79

Contents?: true

Size: 788 Bytes

Versions: 12

Compression:

Stored size: 788 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 = {
              'net.peer.name' => req.uri.host,
              'net.peer.port' => req.uri.port
            }.merge!(OpenTelemetry::Common::HTTP::ClientContext.attributes)

            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

12 entries across 12 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-http-0.23.5 lib/opentelemetry/instrumentation/http/patches/connection.rb
opentelemetry-instrumentation-http-0.23.4 lib/opentelemetry/instrumentation/http/patches/connection.rb
opentelemetry-instrumentation-http-0.23.3 lib/opentelemetry/instrumentation/http/patches/connection.rb
opentelemetry-instrumentation-http-0.23.2 lib/opentelemetry/instrumentation/http/patches/connection.rb
opentelemetry-instrumentation-http-0.23.1 lib/opentelemetry/instrumentation/http/patches/connection.rb
opentelemetry-instrumentation-http-0.23.0 lib/opentelemetry/instrumentation/http/patches/connection.rb
opentelemetry-instrumentation-http-0.22.0 lib/opentelemetry/instrumentation/http/patches/connection.rb
opentelemetry-instrumentation-http-0.21.0 lib/opentelemetry/instrumentation/http/patches/connection.rb
opentelemetry-instrumentation-http-0.20.0 lib/opentelemetry/instrumentation/http/patches/connection.rb
opentelemetry-instrumentation-http-0.19.6 lib/opentelemetry/instrumentation/http/patches/connection.rb
opentelemetry-instrumentation-http-0.19.5 lib/opentelemetry/instrumentation/http/patches/connection.rb
opentelemetry-instrumentation-http-0.19.4 lib/opentelemetry/instrumentation/http/patches/connection.rb