opentelemetry-instrumentation-net_http 0.26.1 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d2f9f6258500f5ab93b13a049110172c6debbe70e058c160377fc540a8c994a1
4
- data.tar.gz: 6c8e7898b77c26263bcb10cd6a5eb393774867ed94d6206dfec07fb4ab3c8bde
3
+ metadata.gz: 53bd74e04f88cdbc957e2bea8c28f6164f0ebe78814d56cbe222b00757a8cfe6
4
+ data.tar.gz: c854319903b2d3e600daf1b151af069c4acfd4b62034ec41d639c6e811118497
5
5
  SHA512:
6
- metadata.gz: 7d4dd3bc8a81c7c6ec0a35f77a6facadd6680a11f8b1fb07c47fb577e7e830356c0bfef62732293f7e096bcc9ff02948eb3096fd72a0c6f2a39d57d00c96e5f7
7
- data.tar.gz: 4181e65cf2a9b74372f75b81f32a3419f43d77412277f7977d51df038a392b1ee3dcd5ec1b4c60851def8c406575181d7de474e4bcc647562d0e56a72d7e7bbe
6
+ metadata.gz: 567957c73eda58ee4e560ede96646b03f4570392109e1e826246cfb6d739c8e80a3cb44da2a5335372a4bf065c917ba35aef3ccdb729650bba332dd8399e15ca
7
+ data.tar.gz: edfc740a298eff286668130b1c1e804049c602e61dc25f8024a91e7661899e1fbd5bc54cd077665d24cddbb0f4883751ca41ffda4d6a202c2c04c27b77618471
data/CHANGELOG.md CHANGED
@@ -1,173 +1,182 @@
1
1
  # Release History: opentelemetry-instrumentation-net_http
2
2
 
3
- ### v0.26.1 / 2025-11-25
3
+ ## v0.29.0 / 2026-04-14
4
4
 
5
- * FIXED: Update support for unknown HTTP methods to match semantic conventions
5
+ - BREAKING CHANGE: Min Ruby Version 3.3 (#2125)
6
+ - ADDED: Min Ruby Version 3.3 (#2125)
7
+ - ADDED: Add release tag into source code url of gem metadata (#1984)
6
8
 
7
- ### v0.26.0 / 2025-10-22
9
+ ## v0.28.0 / 2026-03-17
8
10
 
9
- * BREAKING CHANGE: Min Ruby Version 3.2
11
+ - BREAKING CHANGE: Default to stable HTTP semantic conventions (#2051)
12
+ - ADDED: Default to stable HTTP semantic conventions (#2051)
10
13
 
11
- * ADDED: Min Ruby Version 3.2
14
+ ## v0.27.0 / 2026-01-13
12
15
 
13
- ### v0.25.1 / 2025-09-30
16
+ - ADDED: HTTP Client Semconv v1.17 Span Naming
14
17
 
15
- * FIXED: Min OTel Ruby API 1.7
18
+ ## v0.26.1 / 2025-11-25
16
19
 
17
- ### v0.25.0 / 2025-09-30
20
+ - FIXED: Update support for unknown HTTP methods to match semantic conventions
18
21
 
19
- * ADDED: Bump minimum API Version to 1.7
22
+ ## v0.26.0 / 2025-10-22
20
23
 
21
- ### v0.24.0 / 2025-08-26
24
+ - BREAKING CHANGE: Min Ruby Version 3.2
25
+ - ADDED: Min Ruby Version 3.2
22
26
 
23
- * ADDED: Add `OTEL_SEMCONV_STABILITY_OPT_IN` environment variable compatibility [#1572](https://github.com/open-telemetry/opentelemetry-ruby-contrib/pull/1572)
27
+ ## v0.25.1 / 2025-09-30
24
28
 
25
- ### v0.23.1 / 2025-08-13
29
+ - FIXED: Min OTel Ruby API 1.7
26
30
 
27
- * FIXED: net_http and aws_sdk ci fix
31
+ ## v0.25.0 / 2025-09-30
28
32
 
29
- ### v0.23.0 / 2025-01-16
33
+ - ADDED: Bump minimum API Version to 1.7
30
34
 
31
- * BREAKING CHANGE: Set minimum supported version to Ruby 3.1
35
+ ## v0.24.0 / 2025-08-26
32
36
 
33
- * ADDED: Set minimum supported version to Ruby 3.1
37
+ - ADDED: Add `OTEL_SEMCONV_STABILITY_OPT_IN` environment variable compatibility [#1572](https://github.com/open-telemetry/opentelemetry-ruby-contrib/pull/1572)
34
38
 
35
- ### v0.22.8 / 2024-11-26
39
+ ## v0.23.1 / 2025-08-13
36
40
 
37
- * CHANGED: Performance Freeze all range objects #1222
41
+ - FIXED: net_http and aws_sdk ci fix
38
42
 
39
- ### v0.22.7 / 2024-07-23
43
+ ## v0.23.0 / 2025-01-16
40
44
 
41
- * DOCS: Add cspell to CI
45
+ - BREAKING CHANGE: Set minimum supported version to Ruby 3.1
46
+ - ADDED: Set minimum supported version to Ruby 3.1
42
47
 
43
- ### v0.22.6 / 2024-06-18
48
+ ## v0.22.8 / 2024-11-26
44
49
 
45
- * FIXED: Relax otel common gem constraints
50
+ - CHANGED: Performance Freeze all range objects #1222
46
51
 
47
- ### v0.22.5 / 2024-05-09
52
+ ## v0.22.7 / 2024-07-23
48
53
 
49
- * FIXED: Untrace entire request
54
+ - DOCS: Add cspell to CI
50
55
 
51
- ### v0.22.4 / 2023-11-23
56
+ ## v0.22.6 / 2024-06-18
52
57
 
53
- * CHANGED: Applied Rubocop Performance Recommendations [#727](https://github.com/open-telemetry/opentelemetry-ruby-contrib/pull/727)
58
+ - FIXED: Relax otel common gem constraints
54
59
 
55
- ### v0.22.3 / 2023-11-22
60
+ ## v0.22.5 / 2024-05-09
56
61
 
57
- * FIXED: Update `Net::HTTP` instrumentation to no-op on untraced contexts
62
+ - FIXED: Untrace entire request
58
63
 
59
- ### v0.22.2 / 2023-07-21
64
+ ## v0.22.4 / 2023-11-23
60
65
 
61
- * ADDED: Update `opentelemetry-common` from [0.19.3 to 0.20.0](https://github.com/open-telemetry/opentelemetry-ruby-contrib/pull/537)
66
+ - CHANGED: Applied Rubocop Performance Recommendations [#727](https://github.com/open-telemetry/opentelemetry-ruby-contrib/pull/727)
62
67
 
63
- ### v0.22.1 / 2023-06-05
68
+ ## v0.22.3 / 2023-11-22
64
69
 
65
- * FIXED: Base config options
70
+ - FIXED: Update `Net::HTTP` instrumentation to no-op on untraced contexts
66
71
 
67
- ### v0.22.0 / 2023-04-17
72
+ ## v0.22.2 / 2023-07-21
68
73
 
69
- * BREAKING CHANGE: Drop support for EoL Ruby 2.7
74
+ - ADDED: Update `opentelemetry-common` from [0.19.3 to 0.20.0](https://github.com/open-telemetry/opentelemetry-ruby-contrib/pull/537)
70
75
 
71
- * ADDED: Drop support for EoL Ruby 2.7
72
- * FIXED: Drop Rails dependency for ActiveSupport Instrumentation
76
+ ## v0.22.1 / 2023-06-05
73
77
 
74
- ### v0.21.1 / 2023-01-14
78
+ - FIXED: Base config options
75
79
 
76
- * FIXED: Add untraced check to the Net::HTTP connect instrumentation
77
- * DOCS: Fix gem homepage
78
- * DOCS: More gem documentation fixes
80
+ ## v0.22.0 / 2023-04-17
79
81
 
80
- ### v0.21.0 / 2022-10-04
82
+ - BREAKING CHANGE: Drop support for EoL Ruby 2.7
83
+ - ADDED: Drop support for EoL Ruby 2.7
84
+ - FIXED: Drop Rails dependency for ActiveSupport Instrumentation
81
85
 
82
- * ADDED: Add Net::HTTP :untraced_hosts option
83
- * FIXED: Rename HTTP CONNECT for low level connection spans
86
+ ## v0.21.1 / 2023-01-14
84
87
 
85
- ### v0.20.0 / 2022-06-09
88
+ - FIXED: Add untraced check to the Net::HTTP connect instrumentation
89
+ - DOCS: Fix gem homepage
90
+ - DOCS: More gem documentation fixes
86
91
 
87
- * Upgrading Base dependency version
88
- * FIXED: Broken test file requirements
92
+ ## v0.21.0 / 2022-10-04
89
93
 
90
- ### v0.19.5 / 2022-05-05
94
+ - ADDED: Add Net::HTTP :untraced_hosts option
95
+ - FIXED: Rename HTTP CONNECT for low level connection spans
91
96
 
92
- * (No significant changes)
97
+ ## v0.20.0 / 2022-06-09
93
98
 
94
- ### v0.19.4 / 2022-02-02
99
+ - Upgrading Base dependency version
100
+ - FIXED: Broken test file requirements
95
101
 
96
- * FIXED: Clientcontext attrs overwrite in net::http
97
- * FIXED: Excessive hash creation on context attr merging
102
+ ## v0.19.5 / 2022-05-05
98
103
 
99
- ### v0.19.3 / 2021-12-01
104
+ - (No significant changes)
100
105
 
101
- * FIXED: Change net attribute names to match the semantic conventions spec for http
106
+ ## v0.19.4 / 2022-02-02
102
107
 
103
- ### v0.19.2 / 2021-09-29
108
+ - FIXED: Client Context attrs overwrite in net::http
109
+ - FIXED: Excessive hash creation on context attr merging
104
110
 
105
- * (No significant changes)
111
+ ## v0.19.3 / 2021-12-01
106
112
 
107
- ### v0.19.1 / 2021-08-12
113
+ - FIXED: Change net attribute names to match the semantic conventions spec for http
108
114
 
109
- * DOCS: Update docs to rely more on environment variable configuration
115
+ ## v0.19.2 / 2021-09-29
110
116
 
111
- ### v0.19.0 / 2021-06-23
117
+ - (No significant changes)
112
118
 
113
- * BREAKING CHANGE: Total order constraint on span.status=
119
+ ## v0.19.1 / 2021-08-12
114
120
 
115
- * FIXED: Total order constraint on span.status=
121
+ - DOCS: Update docs to rely more on environment variable configuration
116
122
 
117
- ### v0.18.0 / 2021-05-21
123
+ ## v0.19.0 / 2021-06-23
118
124
 
119
- * ADDED: Updated API dependency for 1.0.0.rc1
125
+ - BREAKING CHANGE: Total order constraint on span.status=
126
+ - FIXED: Total order constraint on span.status=
120
127
 
121
- ### v0.17.0 / 2021-04-22
128
+ ## v0.18.0 / 2021-05-21
122
129
 
123
- * FIXED: Refactor propagators to add #fields
130
+ - ADDED: Updated API dependency for 1.0.0.rc1
124
131
 
125
- ### v0.16.0 / 2021-03-17
132
+ ## v0.17.0 / 2021-04-22
126
133
 
127
- * FIXED: Example scripts now reference local common lib
128
- * DOCS: Replace Gitter with GitHub Discussions
134
+ - FIXED: Refactor propagators to add #fields
129
135
 
130
- ### v0.15.0 / 2021-02-18
136
+ ## v0.16.0 / 2021-03-17
131
137
 
132
- * ADDED: Add Net::HTTP#connect tracing
138
+ - FIXED: Example scripts now reference local common lib
139
+ - DOCS: Replace Gitter with GitHub Discussions
133
140
 
134
- ### v0.14.0 / 2021-02-03
141
+ ## v0.15.0 / 2021-02-18
135
142
 
136
- * BREAKING CHANGE: Replace getter and setter callables and remove rack specific propagators
143
+ - ADDED: Add Net::HTTP#connect tracing
137
144
 
138
- * ADDED: Replace getter and setter callables and remove rack specific propagators
145
+ ## v0.14.0 / 2021-02-03
139
146
 
140
- ### v0.13.0 / 2021-01-29
147
+ - BREAKING CHANGE: Replace getter and setter callables and remove rack specific propagators
148
+ - ADDED: Replace getter and setter callables and remove rack specific propagators
141
149
 
142
- * (No significant changes)
150
+ ## v0.13.0 / 2021-01-29
143
151
 
144
- ### v0.12.0 / 2020-12-24
152
+ - (No significant changes)
145
153
 
146
- * (No significant changes)
154
+ ## v0.12.0 / 2020-12-24
147
155
 
148
- ### v0.11.0 / 2020-12-11
156
+ - (No significant changes)
149
157
 
150
- * FIXED: Copyright comments to not reference year
158
+ ## v0.11.0 / 2020-12-11
151
159
 
152
- ### v0.10.0 / 2020-12-03
160
+ - FIXED: Copyright comments to not reference year
153
161
 
154
- * (No significant changes)
162
+ ## v0.10.0 / 2020-12-03
155
163
 
156
- ### v0.9.0 / 2020-11-27
164
+ - (No significant changes)
157
165
 
158
- * ADDED: Add common helpers
166
+ ## v0.9.0 / 2020-11-27
159
167
 
160
- ### v0.8.0 / 2020-10-27
168
+ - ADDED: Add common helpers
161
169
 
162
- * BREAKING CHANGE: Remove 'canonical' from status codes
170
+ ## v0.8.0 / 2020-10-27
163
171
 
164
- * FIXED: Remove 'canonical' from status codes
172
+ - BREAKING CHANGE: Remove 'canonical' from status codes
173
+ - FIXED: Remove 'canonical' from status codes
165
174
 
166
- ### v0.7.0 / 2020-10-07
175
+ ## v0.7.0 / 2020-10-07
167
176
 
168
- * DOCS: Added documentation for net_http gem in instrumentation
169
- * DOCS: Standardize top-level docs structure and readme
177
+ - DOCS: Added documentation for net_http gem in instrumentation
178
+ - DOCS: Standardize top-level docs structure and readme
170
179
 
171
- ### v0.6.0 / 2020-09-10
180
+ ## v0.6.0 / 2020-09-10
172
181
 
173
- * (No significant changes)
182
+ - (No significant changes)
data/README.md CHANGED
@@ -55,16 +55,12 @@ Apache 2.0 license. See [LICENSE][license-github] for more information.
55
55
 
56
56
  ## HTTP semantic convention stability
57
57
 
58
- In the OpenTelemetry ecosystem, HTTP semantic conventions have now reached a stable state. However, the initial Net::HTTP instrumentation was introduced before this stability was achieved, which resulted in HTTP attributes being based on an older version of the semantic conventions.
59
-
60
- To facilitate the migration to stable semantic conventions, you can use the `OTEL_SEMCONV_STABILITY_OPT_IN` environment variable. This variable allows you to opt-in to the new stable conventions, ensuring compatibility and future-proofing your instrumentation.
58
+ This instrumentation by default emits the stable HTTP semantic conventions. The `OTEL_SEMCONV_STABILITY_OPT_IN` environment variable can be used to opt-in to the old or duplicate (both old and stable) semantic conventions.
61
59
 
62
60
  When setting the value for `OTEL_SEMCONV_STABILITY_OPT_IN`, you can specify which conventions you wish to adopt:
63
61
 
64
- - `http` - Emits the stable HTTP and networking conventions and ceases emitting the old conventions previously emitted by the instrumentation.
65
- - `http/dup` - Emits both the old and stable HTTP and networking conventions, enabling a phased rollout of the stable semantic conventions.
66
- - Default behavior (in the absence of either value) is to continue emitting the old HTTP and networking conventions the instrumentation previously emitted.
67
-
68
- During the transition from old to stable conventions, Net::HTTP instrumentation code comes in three patch versions: `dup`, `old`, and `stable`. These versions are identical except for the attributes they send. Any changes to Net::HTTP instrumentation should consider all three patches.
62
+ - `http` - Emits the stable HTTP and networking conventions.
63
+ - `http/dup` - **DEPRECATED: Will be removed on April 15, 2026.** Emits both the old and stable HTTP and networking conventions.
64
+ - `old` - **DEPRECATED: Will be removed on April 15, 2026.** Emits the old HTTP and networking conventions.
69
65
 
70
- For additional information on migration, please refer to our [documentation](https://opentelemetry.io/docs/specs/semconv/non-normative/http-migration/).
66
+ For additional information on migration, please refer to our [documentation](https://opentelemetry.io/docs/specs/semconv/non-normative/http-migration/).
@@ -12,7 +12,7 @@ module OpenTelemetry
12
12
  # @api private
13
13
  module HttpHelper
14
14
  # Lightweight struct to hold span creation attributes
15
- SpanCreationAttributes = Struct.new(:span_name, :normalized_method, :original_method, keyword_init: true)
15
+ SpanCreationAttributes = Struct.new(:span_name, :attributes)
16
16
 
17
17
  # Pre-computed mapping to avoid string allocations during normalization
18
18
  METHOD_CACHE = {
@@ -45,41 +45,89 @@ module OpenTelemetry
45
45
  :trace => 'TRACE'
46
46
  }.freeze
47
47
 
48
- # Pre-computed span names for old semantic conventions to avoid allocations
49
- OLD_SPAN_NAMES = {
50
- 'CONNECT' => 'HTTP CONNECT',
51
- 'DELETE' => 'HTTP DELETE',
52
- 'GET' => 'HTTP GET',
53
- 'HEAD' => 'HTTP HEAD',
54
- 'OPTIONS' => 'HTTP OPTIONS',
55
- 'PATCH' => 'HTTP PATCH',
56
- 'POST' => 'HTTP POST',
57
- 'PUT' => 'HTTP PUT',
58
- 'TRACE' => 'HTTP TRACE'
59
- }.freeze
48
+ private_constant :METHOD_CACHE
49
+
50
+ OLD_SPAN_NAMES_BY_METHOD = METHOD_CACHE.values.uniq.to_h do |method|
51
+ [method, "HTTP #{method}"]
52
+ end.freeze
60
53
 
61
- private_constant :METHOD_CACHE, :OLD_SPAN_NAMES
54
+ private_constant :OLD_SPAN_NAMES_BY_METHOD
62
55
 
63
- # Prepares all span data for the specified semantic convention in a single call
56
+ # Prepares span data using old semantic conventions
64
57
  # @param method [String, Symbol] The HTTP method
65
- # @param semconv [Symbol] The semantic convention to use (:stable or :old)
66
- # @return [SpanCreationAttributes] struct containing span_name, normalized_method, and original_method
67
- def self.span_attrs_for(method, semconv: :stable)
58
+ # @return [SpanCreationAttributes] struct containing span_name and attributes hash
59
+ def self.span_attrs_for_old(method)
60
+ client_context_attrs = OpenTelemetry::Common::HTTP::ClientContext.attributes
68
61
  normalized = METHOD_CACHE[method]
62
+ attributes = client_context_attrs.dup
63
+
64
+ # Determine base span name and method value
65
+ if normalized
66
+ span_name = OLD_SPAN_NAMES_BY_METHOD[normalized]
67
+ method_value = normalized
68
+ else
69
+ span_name = 'HTTP'
70
+ method_value = '_OTHER'
71
+ end
72
+
73
+ attributes['http.method'] ||= method_value
74
+
75
+ SpanCreationAttributes.new(span_name: span_name, attributes: attributes)
76
+ end
77
+
78
+ # Prepares span data using stable semantic conventions
79
+ # @param method [String, Symbol] The HTTP method
80
+ # @return [SpanCreationAttributes] struct containing span_name and attributes hash
81
+ def self.span_attrs_for_stable(method)
82
+ client_context_attrs = OpenTelemetry::Common::HTTP::ClientContext.attributes
83
+ url_template = client_context_attrs['url.template']
84
+ normalized = METHOD_CACHE[method]
85
+ attributes = client_context_attrs.dup
86
+
87
+ # Determine base span name and method value
69
88
  if normalized
70
- span_name = semconv == :old ? OLD_SPAN_NAMES[normalized] : normalized
71
- SpanCreationAttributes.new(
72
- span_name: span_name,
73
- normalized_method: normalized,
74
- original_method: nil
75
- )
89
+ base_name = normalized
90
+ method_value = normalized
91
+ original = nil
76
92
  else
77
- SpanCreationAttributes.new(
78
- span_name: 'HTTP',
79
- normalized_method: '_OTHER',
80
- original_method: method.to_s
81
- )
93
+ base_name = 'HTTP'
94
+ method_value = '_OTHER'
95
+ original = method.to_s
82
96
  end
97
+
98
+ span_name = url_template ? "#{base_name} #{url_template}" : base_name
99
+ attributes['http.request.method'] ||= method_value
100
+ attributes['http.request.method_original'] ||= original if original
101
+
102
+ SpanCreationAttributes.new(span_name: span_name, attributes: attributes)
103
+ end
104
+
105
+ # Prepares span data using both old and stable semantic conventions
106
+ # @param method [String, Symbol] The HTTP method
107
+ # @return [SpanCreationAttributes] struct containing span_name and attributes hash
108
+ def self.span_attrs_for_dup(method)
109
+ client_context_attrs = OpenTelemetry::Common::HTTP::ClientContext.attributes
110
+ url_template = client_context_attrs['url.template']
111
+ normalized = METHOD_CACHE[method]
112
+ attributes = client_context_attrs.dup
113
+
114
+ # Determine base span name and method value
115
+ if normalized
116
+ base_name = normalized
117
+ method_value = normalized
118
+ original = nil
119
+ else
120
+ base_name = 'HTTP'
121
+ method_value = '_OTHER'
122
+ original = method.to_s
123
+ end
124
+
125
+ span_name = url_template ? "#{base_name} #{url_template}" : base_name
126
+ attributes['http.method'] ||= method_value
127
+ attributes['http.request.method'] ||= method_value
128
+ attributes['http.request.method_original'] ||= original if original
129
+
130
+ SpanCreationAttributes.new(span_name: span_name, attributes: attributes)
83
131
  end
84
132
  end
85
133
  end
@@ -36,14 +36,20 @@ module OpenTelemetry
36
36
  values = stability_opt_in.split(',').map(&:strip)
37
37
 
38
38
  if values.include?('http/dup')
39
+ emit_old_semconv_deprecation_warning('http/dup')
39
40
  'dup'
40
- elsif values.include?('http')
41
- 'stable'
42
- else
41
+ elsif values.include?('old')
42
+ emit_old_semconv_deprecation_warning('old')
43
43
  'old'
44
+ else
45
+ 'stable'
44
46
  end
45
47
  end
46
48
 
49
+ def emit_old_semconv_deprecation_warning(option)
50
+ OpenTelemetry.logger.warn("The `#{option}` option for OTEL_SEMCONV_STABILITY_OPT_IN is deprecated and will be removed on April 15, 2026. Please migrate to the stable HTTP semantic conventions.")
51
+ end
52
+
47
53
  def require_dependencies_dup
48
54
  require_relative 'patches/dup/instrumentation'
49
55
  end
@@ -23,25 +23,19 @@ module OpenTelemetry
23
23
 
24
24
  return super if untraced?
25
25
 
26
- span_data = HttpHelper.span_attrs_for(req.method)
27
-
28
- attributes = {
29
- OpenTelemetry::SemanticConventions::Trace::HTTP_METHOD => span_data.normalized_method,
30
- OpenTelemetry::SemanticConventions::Trace::HTTP_SCHEME => USE_SSL_TO_SCHEME[use_ssl?],
31
- OpenTelemetry::SemanticConventions::Trace::HTTP_TARGET => req.path,
32
- OpenTelemetry::SemanticConventions::Trace::NET_PEER_NAME => @address,
33
- OpenTelemetry::SemanticConventions::Trace::NET_PEER_PORT => @port,
34
- 'http.request.method' => span_data.normalized_method,
35
- 'url.scheme' => USE_SSL_TO_SCHEME[use_ssl?],
36
- 'server.address' => @address,
37
- 'server.port' => @port
38
- }
39
- attributes['http.request.method_original'] = span_data.original_method if span_data.original_method
26
+ span_data = HttpHelper.span_attrs_for_dup(req.method)
27
+
28
+ attributes = { OpenTelemetry::SemanticConventions::Trace::HTTP_SCHEME => USE_SSL_TO_SCHEME[use_ssl?],
29
+ OpenTelemetry::SemanticConventions::Trace::HTTP_TARGET => req.path,
30
+ OpenTelemetry::SemanticConventions::Trace::NET_PEER_NAME => @address,
31
+ OpenTelemetry::SemanticConventions::Trace::NET_PEER_PORT => @port, 'url.scheme' => USE_SSL_TO_SCHEME[use_ssl?],
32
+ 'server.address' => @address,
33
+ 'server.port' => @port }
40
34
  path, query = split_path_and_query(req.path)
41
35
  attributes['url.path'] = path
42
36
  attributes['url.query'] = query if query
43
37
 
44
- attributes.merge!(OpenTelemetry::Common::HTTP::ClientContext.attributes)
38
+ attributes.merge!(span_data.attributes)
45
39
 
46
40
  tracer.in_span(
47
41
  span_data.span_name,
@@ -23,15 +23,12 @@ module OpenTelemetry
23
23
 
24
24
  return super if untraced?
25
25
 
26
- span_data = HttpHelper.span_attrs_for(req.method, semconv: :old)
26
+ span_data = HttpHelper.span_attrs_for_old(req.method)
27
27
 
28
- attributes = {
29
- OpenTelemetry::SemanticConventions::Trace::HTTP_METHOD => span_data.normalized_method,
30
- OpenTelemetry::SemanticConventions::Trace::HTTP_SCHEME => USE_SSL_TO_SCHEME[use_ssl?],
31
- OpenTelemetry::SemanticConventions::Trace::HTTP_TARGET => req.path,
32
- OpenTelemetry::SemanticConventions::Trace::NET_PEER_NAME => @address,
33
- OpenTelemetry::SemanticConventions::Trace::NET_PEER_PORT => @port
34
- }.merge!(OpenTelemetry::Common::HTTP::ClientContext.attributes)
28
+ attributes = { OpenTelemetry::SemanticConventions::Trace::HTTP_SCHEME => USE_SSL_TO_SCHEME[use_ssl?],
29
+ OpenTelemetry::SemanticConventions::Trace::HTTP_TARGET => req.path,
30
+ OpenTelemetry::SemanticConventions::Trace::NET_PEER_NAME => @address,
31
+ OpenTelemetry::SemanticConventions::Trace::NET_PEER_PORT => @port }.merge!(span_data.attributes)
35
32
 
36
33
  tracer.in_span(
37
34
  span_data.span_name,
@@ -23,20 +23,16 @@ module OpenTelemetry
23
23
 
24
24
  return super if untraced?
25
25
 
26
- span_data = HttpHelper.span_attrs_for(req.method)
26
+ span_data = HttpHelper.span_attrs_for_stable(req.method)
27
27
 
28
- attributes = {
29
- 'http.request.method' => span_data.normalized_method,
30
- 'url.scheme' => USE_SSL_TO_SCHEME[use_ssl?],
31
- 'server.address' => @address,
32
- 'server.port' => @port
33
- }
34
- attributes['http.request.method_original'] = span_data.original_method if span_data.original_method
28
+ attributes = { 'url.scheme' => USE_SSL_TO_SCHEME[use_ssl?],
29
+ 'server.address' => @address,
30
+ 'server.port' => @port }
35
31
  path, query = split_path_and_query(req.path)
36
32
  attributes['url.path'] = path
37
33
  attributes['url.query'] = query if query
38
34
 
39
- attributes.merge!(OpenTelemetry::Common::HTTP::ClientContext.attributes)
35
+ attributes.merge!(span_data.attributes)
40
36
 
41
37
  tracer.in_span(
42
38
  span_data.span_name,
@@ -8,7 +8,7 @@ module OpenTelemetry
8
8
  module Instrumentation
9
9
  module Net
10
10
  module HTTP
11
- VERSION = '0.26.1'
11
+ VERSION = '0.29.0'
12
12
  end
13
13
  end
14
14
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opentelemetry-instrumentation-net_http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.26.1
4
+ version: 0.29.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenTelemetry Authors
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-11-25 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: opentelemetry-instrumentation-base
@@ -48,11 +47,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
48
47
  licenses:
49
48
  - Apache-2.0
50
49
  metadata:
51
- changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-net_http/0.26.1/file/CHANGELOG.md
52
- source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation/net_http
50
+ changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-net_http/0.29.0/file/CHANGELOG.md
51
+ source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/opentelemetry-instrumentation-net_http/v0.29.0/instrumentation/net_http
53
52
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
54
- documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-net_http/0.26.1
55
- post_install_message:
53
+ documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-net_http/0.29.0
56
54
  rdoc_options: []
57
55
  require_paths:
58
56
  - lib
@@ -60,15 +58,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
60
58
  requirements:
61
59
  - - ">="
62
60
  - !ruby/object:Gem::Version
63
- version: '3.2'
61
+ version: '3.3'
64
62
  required_rubygems_version: !ruby/object:Gem::Requirement
65
63
  requirements:
66
64
  - - ">="
67
65
  - !ruby/object:Gem::Version
68
66
  version: '0'
69
67
  requirements: []
70
- rubygems_version: 3.4.19
71
- signing_key:
68
+ rubygems_version: 4.0.6
72
69
  specification_version: 4
73
70
  summary: Net::HTTP instrumentation for the OpenTelemetry framework
74
71
  test_files: []