opentelemetry-instrumentation-net_http 0.29.0 → 0.29.2

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: 53bd74e04f88cdbc957e2bea8c28f6164f0ebe78814d56cbe222b00757a8cfe6
4
- data.tar.gz: c854319903b2d3e600daf1b151af069c4acfd4b62034ec41d639c6e811118497
3
+ metadata.gz: 66e575e14595df6a6abf6646c1d641e2720b08a9c1a2eba53c8951d72411385a
4
+ data.tar.gz: 971d0de75ffd644e7143c0cf22768e3f5b775a923cd774462bf8aec125c5d335
5
5
  SHA512:
6
- metadata.gz: 567957c73eda58ee4e560ede96646b03f4570392109e1e826246cfb6d739c8e80a3cb44da2a5335372a4bf065c917ba35aef3ccdb729650bba332dd8399e15ca
7
- data.tar.gz: edfc740a298eff286668130b1c1e804049c602e61dc25f8024a91e7661899e1fbd5bc54cd077665d24cddbb0f4883751ca41ffda4d6a202c2c04c27b77618471
6
+ metadata.gz: 741450ff34b7c839f8d8ba906ff1bb5d468f5c40c4294a78e8746d430f3d3c40f7448c776325e9f80bd980eba182ca4130dbbf334dbb095fc4caf95084ea1a95
7
+ data.tar.gz: a7c244f250393ce3370f5879b7befc8889a125c8c8e8b68a7cfa72321d21d00122d3989451061e566cf4add53c1432cfed4fa92376fd8ffa14c7d6b894d68aa8
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Release History: opentelemetry-instrumentation-net_http
2
2
 
3
+ ## v0.29.2 / 2026-10-06
4
+
5
+ - FIXED: Normalize URI-like request paths on `Net::HTTP` instrumentation (#2591)
6
+
7
+ ## v0.29.1 / 2026-09-15
8
+
9
+ - FIXED: Omit nil attributes on spans (#2558)
10
+
3
11
  ## v0.29.0 / 2026-04-14
4
12
 
5
13
  - BREAKING CHANGE: Min Ruby Version 3.3 (#2125)
@@ -14,6 +14,25 @@ module OpenTelemetry
14
14
  # Lightweight struct to hold span creation attributes
15
15
  SpanCreationAttributes = Struct.new(:span_name, :attributes)
16
16
 
17
+ # Returns the request path for strings and URI-like objects.
18
+ # @param path [String, #request_uri] The request path
19
+ # @return [String, nil] The normalized request path
20
+ def self.request_path(path)
21
+ path.respond_to?(:request_uri) ? path.request_uri : path
22
+ end
23
+
24
+ # Splits a request path into its path and query components.
25
+ # @param path [String, #request_uri] The request path
26
+ # @return [Array<String, String, nil>] The path and query components
27
+ def self.split_path_and_query(path)
28
+ path = request_path(path)
29
+ return [nil, nil] unless path
30
+
31
+ path_and_query = path.split('?')
32
+
33
+ [path_and_query[0], path_and_query[1]]
34
+ end
35
+
17
36
  # Pre-computed mapping to avoid string allocations during normalization
18
37
  METHOD_CACHE = {
19
38
  'CONNECT' => 'CONNECT',
@@ -26,13 +26,13 @@ module OpenTelemetry
26
26
  span_data = HttpHelper.span_attrs_for_dup(req.method)
27
27
 
28
28
  attributes = { OpenTelemetry::SemanticConventions::Trace::HTTP_SCHEME => USE_SSL_TO_SCHEME[use_ssl?],
29
- OpenTelemetry::SemanticConventions::Trace::HTTP_TARGET => req.path,
29
+ OpenTelemetry::SemanticConventions::Trace::HTTP_TARGET => HttpHelper.request_path(req.path),
30
30
  OpenTelemetry::SemanticConventions::Trace::NET_PEER_NAME => @address,
31
31
  OpenTelemetry::SemanticConventions::Trace::NET_PEER_PORT => @port, 'url.scheme' => USE_SSL_TO_SCHEME[use_ssl?],
32
32
  'server.address' => @address,
33
- 'server.port' => @port }
34
- path, query = split_path_and_query(req.path)
35
- attributes['url.path'] = path
33
+ 'server.port' => @port }.compact
34
+ path, query = HttpHelper.split_path_and_query(req.path)
35
+ attributes['url.path'] = path if path
36
36
  attributes['url.query'] = query if query
37
37
 
38
38
  attributes.merge!(span_data.attributes)
@@ -68,7 +68,7 @@ module OpenTelemetry
68
68
  OpenTelemetry::SemanticConventions::Trace::NET_PEER_PORT => conn_port,
69
69
  'server.address' => conn_address,
70
70
  'server.port' => conn_port
71
- }.merge!(OpenTelemetry::Common::HTTP::ClientContext.attributes)
71
+ }.compact.merge!(OpenTelemetry::Common::HTTP::ClientContext.attributes)
72
72
 
73
73
  if use_ssl? && proxy?
74
74
  span_name = 'CONNECT'
@@ -112,12 +112,6 @@ module OpenTelemetry
112
112
  def untraced_context?
113
113
  OpenTelemetry::Common::Utilities.untraced?
114
114
  end
115
-
116
- def split_path_and_query(path)
117
- path_and_query = path.split('?')
118
-
119
- [path_and_query[0], path_and_query[1]]
120
- end
121
115
  end
122
116
  end
123
117
  end
@@ -26,9 +26,9 @@ module OpenTelemetry
26
26
  span_data = HttpHelper.span_attrs_for_old(req.method)
27
27
 
28
28
  attributes = { OpenTelemetry::SemanticConventions::Trace::HTTP_SCHEME => USE_SSL_TO_SCHEME[use_ssl?],
29
- OpenTelemetry::SemanticConventions::Trace::HTTP_TARGET => req.path,
29
+ OpenTelemetry::SemanticConventions::Trace::HTTP_TARGET => HttpHelper.request_path(req.path),
30
30
  OpenTelemetry::SemanticConventions::Trace::NET_PEER_NAME => @address,
31
- OpenTelemetry::SemanticConventions::Trace::NET_PEER_PORT => @port }.merge!(span_data.attributes)
31
+ OpenTelemetry::SemanticConventions::Trace::NET_PEER_PORT => @port }.compact.merge!(span_data.attributes)
32
32
 
33
33
  tracer.in_span(
34
34
  span_data.span_name,
@@ -59,7 +59,7 @@ module OpenTelemetry
59
59
  attributes = {
60
60
  OpenTelemetry::SemanticConventions::Trace::NET_PEER_NAME => conn_address,
61
61
  OpenTelemetry::SemanticConventions::Trace::NET_PEER_PORT => conn_port
62
- }.merge!(OpenTelemetry::Common::HTTP::ClientContext.attributes)
62
+ }.compact.merge!(OpenTelemetry::Common::HTTP::ClientContext.attributes)
63
63
 
64
64
  if use_ssl? && proxy?
65
65
  span_name = 'HTTP CONNECT'
@@ -27,9 +27,9 @@ module OpenTelemetry
27
27
 
28
28
  attributes = { 'url.scheme' => USE_SSL_TO_SCHEME[use_ssl?],
29
29
  'server.address' => @address,
30
- 'server.port' => @port }
31
- path, query = split_path_and_query(req.path)
32
- attributes['url.path'] = path
30
+ 'server.port' => @port }.compact
31
+ path, query = HttpHelper.split_path_and_query(req.path)
32
+ attributes['url.path'] = path if path
33
33
  attributes['url.query'] = query if query
34
34
 
35
35
  attributes.merge!(span_data.attributes)
@@ -63,7 +63,7 @@ module OpenTelemetry
63
63
  attributes = {
64
64
  'server.address' => conn_address,
65
65
  'server.port' => conn_port
66
- }.merge!(OpenTelemetry::Common::HTTP::ClientContext.attributes)
66
+ }.compact.merge!(OpenTelemetry::Common::HTTP::ClientContext.attributes)
67
67
 
68
68
  if use_ssl? && proxy?
69
69
  span_name = 'CONNECT'
@@ -106,12 +106,6 @@ module OpenTelemetry
106
106
  def untraced_context?
107
107
  OpenTelemetry::Common::Utilities.untraced?
108
108
  end
109
-
110
- def split_path_and_query(path)
111
- path_and_query = path.split('?')
112
-
113
- [path_and_query[0], path_and_query[1]]
114
- end
115
109
  end
116
110
  end
117
111
  end
@@ -8,7 +8,7 @@ module OpenTelemetry
8
8
  module Instrumentation
9
9
  module Net
10
10
  module HTTP
11
- VERSION = '0.29.0'
11
+ VERSION = '0.29.2'
12
12
  end
13
13
  end
14
14
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opentelemetry-instrumentation-net_http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.29.0
4
+ version: 0.29.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenTelemetry Authors
@@ -47,10 +47,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
47
47
  licenses:
48
48
  - Apache-2.0
49
49
  metadata:
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
50
+ changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-net_http/0.29.2/file/CHANGELOG.md
51
+ source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/opentelemetry-instrumentation-net_http/v0.29.2/instrumentation/net_http
52
52
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
53
- documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-net_http/0.29.0
53
+ documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-net_http/0.29.2
54
54
  rdoc_options: []
55
55
  require_paths:
56
56
  - lib
@@ -65,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
65
65
  - !ruby/object:Gem::Version
66
66
  version: '0'
67
67
  requirements: []
68
- rubygems_version: 4.0.6
68
+ rubygems_version: 4.0.16
69
69
  specification_version: 4
70
70
  summary: Net::HTTP instrumentation for the OpenTelemetry framework
71
71
  test_files: []