Sha256: 0fe4a0eea90159faf7bb5046e455babd4e22480e0fa46ebe845439598077a406

Contents?: true

Size: 781 Bytes

Versions: 8

Compression:

Stored size: 781 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(
              'peer.hostname' => req.uri.host,
              '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

8 entries across 8 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-http-0.19.2 lib/opentelemetry/instrumentation/http/patches/connection.rb
opentelemetry-instrumentation-http-0.19.1 lib/opentelemetry/instrumentation/http/patches/connection.rb
opentelemetry-instrumentation-http-0.19.0 lib/opentelemetry/instrumentation/http/patches/connection.rb
opentelemetry-instrumentation-http-0.18.0 lib/opentelemetry/instrumentation/http/patches/connection.rb
opentelemetry-instrumentation-http-0.17.0 lib/opentelemetry/instrumentation/http/patches/connection.rb
opentelemetry-instrumentation-http-0.16.2 lib/opentelemetry/instrumentation/http/patches/connection.rb
opentelemetry-instrumentation-http-0.16.1 lib/opentelemetry/instrumentation/http/patches/connection.rb
opentelemetry-instrumentation-http-0.16.0 lib/opentelemetry/instrumentation/http/patches/connection.rb