Sha256: 4be0519458b0e19e2b3311454c986d4e5bdac4f62fcbe429c6ef123408756f42

Contents?: true

Size: 754 Bytes

Versions: 8

Compression:

Stored size: 754 Bytes

Contents

# frozen_string_literal: true

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

module OpenTelemetry
  module Instrumentation
    module HttpClient
      module Patches
        # Module to prepend to HTTPClient::Session for instrumentation
        module Session
          def connect
            site = @proxy || @dest
            url = site.addr

            attributes = OpenTelemetry::Common::HTTP::ClientContext.attributes.merge('http.url' => url)
            tracer.in_span('HTTP CONNECT', attributes: attributes) do
              super
            end
          end

          private

          def tracer
            HttpClient::Instrumentation.instance.tracer
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-http_client-0.19.3 lib/opentelemetry/instrumentation/http_client/patches/session.rb
opentelemetry-instrumentation-http_client-0.19.2 lib/opentelemetry/instrumentation/http_client/patches/session.rb
opentelemetry-instrumentation-http_client-0.19.1 lib/opentelemetry/instrumentation/http_client/patches/session.rb
opentelemetry-instrumentation-http_client-0.19.0 lib/opentelemetry/instrumentation/http_client/patches/session.rb
opentelemetry-instrumentation-http_client-0.18.0 lib/opentelemetry/instrumentation/http_client/patches/session.rb
opentelemetry-instrumentation-http_client-0.17.0 lib/opentelemetry/instrumentation/http_client/patches/session.rb
opentelemetry-instrumentation-http_client-0.16.0 lib/opentelemetry/instrumentation/http_client/patches/session.rb
opentelemetry-instrumentation-http_client-0.15.0 lib/opentelemetry/instrumentation/http_client/patches/session.rb