Module: OpenTelemetry::Instrumentation::Net::HTTP::HttpHelper Private

Defined in:
lib/opentelemetry/instrumentation/net/http/http_helper.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Utility module for HTTP-related helper methods

Defined Under Namespace

Classes: SpanCreationAttributes

Class Method Summary collapse

Class Method Details

.span_attrs_for(method, semconv: :stable) ⇒ SpanCreationAttributes

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Prepares all span data for the specified semantic convention in a single call

Parameters:

  • method (String, Symbol)

    The HTTP method

  • semconv (Symbol) (defaults to: :stable)

    The semantic convention to use (:stable or :old)

Returns:



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/opentelemetry/instrumentation/net/http/http_helper.rb', line 67

def self.span_attrs_for(method, semconv: :stable)
  normalized = METHOD_CACHE[method]
  if normalized
    span_name = semconv == :old ? OLD_SPAN_NAMES[normalized] : normalized
    SpanCreationAttributes.new(
      span_name: span_name,
      normalized_method: normalized,
      original_method: nil
    )
  else
    SpanCreationAttributes.new(
      span_name: 'HTTP',
      normalized_method: '_OTHER',
      original_method: method.to_s
    )
  end
end