Module: OpenTelemetry::Instrumentation::HTTP::Patches::Dup::Connection

Defined in:
lib/opentelemetry/instrumentation/http/patches/dup/connection.rb

Overview

Module to prepend to HTTP::Connection for instrumentation

Instance Method Summary collapse

Instance Method Details

#initialize(req, options) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/opentelemetry/instrumentation/http/patches/dup/connection.rb', line 15

def initialize(req, options)
  attributes = {
    # old semconv
    'net.peer.name' => req.uri.host,
    'net.peer.port' => req.uri.port,
    # stable semconv
    'server.address' => req.uri.host,
    'server.port' => req.uri.port
  }.merge!(OpenTelemetry::Common::HTTP::ClientContext.attributes)

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