module OpenTelemetry::Instrumentation::HTTP::Patches::Connection

Module to prepend to HTTP::Connection for instrumentation

Public Class Methods

new(req, options) click to toggle source
Calls superclass method
# File lib/opentelemetry/instrumentation/http/patches/connection.rb, line 13
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 Instance Methods

tracer() click to toggle source
# File lib/opentelemetry/instrumentation/http/patches/connection.rb, line 26
def tracer
  HTTP::Instrumentation.instance.tracer
end