Module: OpenTelemetry::Instrumentation::Faraday::HttpHelper Private
- Defined in:
- lib/opentelemetry/instrumentation/faraday/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
-
.span_attrs_for_dup(method) ⇒ SpanCreationAttributes
private
Prepares span data using both old and stable semantic conventions.
-
.span_attrs_for_old(method) ⇒ SpanCreationAttributes
private
Prepares span data using old semantic conventions.
-
.span_attrs_for_stable(method) ⇒ SpanCreationAttributes
private
Prepares span data using stable semantic conventions.
Class Method Details
.span_attrs_for_dup(method) ⇒ 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 span data using both old and stable semantic conventions
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/opentelemetry/instrumentation/faraday/http_helper.rb', line 109 def span_attrs_for_dup(method) client_context_attrs = OpenTelemetry::Common::HTTP::ClientContext.attributes url_template = client_context_attrs['url.template'] normalized = METHOD_CACHE[method] attributes = client_context_attrs.dup # Determine base span name and method value if normalized base_name = normalized method_value = normalized original = nil else base_name = 'HTTP' method_value = '_OTHER' original = method.to_s end span_name = url_template ? "#{base_name} #{url_template}" : base_name attributes['http.method'] ||= method_value attributes['http.request.method'] ||= method_value attributes['http.request.method_original'] ||= original if original SpanCreationAttributes.new(span_name: span_name, attributes: attributes) end |
.span_attrs_for_old(method) ⇒ 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 span data using old semantic conventions
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/opentelemetry/instrumentation/faraday/http_helper.rb', line 60 def span_attrs_for_old(method) client_context_attrs = OpenTelemetry::Common::HTTP::ClientContext.attributes normalized = METHOD_CACHE[method] attributes = client_context_attrs.dup # Determine base span name and method value if normalized span_name = OLD_SPAN_NAMES_BY_METHOD[normalized] method_value = normalized else span_name = 'HTTP' method_value = '_OTHER' end attributes['http.method'] ||= method_value SpanCreationAttributes.new(span_name: span_name, attributes: attributes) end |
.span_attrs_for_stable(method) ⇒ 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 span data using stable semantic conventions
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/opentelemetry/instrumentation/faraday/http_helper.rb', line 82 def span_attrs_for_stable(method) client_context_attrs = OpenTelemetry::Common::HTTP::ClientContext.attributes url_template = client_context_attrs['url.template'] normalized = METHOD_CACHE[method] attributes = client_context_attrs.dup # Determine base span name and method value if normalized base_name = normalized method_value = normalized original = nil else base_name = 'HTTP' method_value = '_OTHER' original = method.to_s end span_name = url_template ? "#{base_name} #{url_template}" : base_name attributes['http.request.method'] ||= method_value attributes['http.request.method_original'] ||= original if original SpanCreationAttributes.new(span_name: span_name, attributes: attributes) end |