opentelemetry-instrumentation-excon 0.26.1 → 0.28.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: a921d5ad6cdca93a94fd432db5cf0d8ef32438912de3ed1d598dc32421b59913
4
- data.tar.gz: dd27126b88bf80c23e3edaf7387dceb85cc5f8127bedc57158572133d551187e
3
+ metadata.gz: 39862549bd2b30f15765db38c10d45e60116acef7e67119120926dad36324ff2
4
+ data.tar.gz: 48b7dfb77c4cd21fbe6d61b0516b6c978a096551c8929a0a727957310a2fe9fa
5
5
  SHA512:
6
- metadata.gz: c138a2b32ca6a3d6c99510a6bdd16407f2451e2e870dc8cf14403628c2268ddb85c3f61d20d3331d868cc76a02c11eaa5b89150714751fc4c76941700b9fc61a
7
- data.tar.gz: ec4d44aea8941398abf1eae8247487c3f1973e6dee70e32c4fa5e3e577e15f9d7e5d1c7e69135f7adece7733db3a8a1ce9bd5546c5c5e19848f6ed6fee8b55ff
6
+ metadata.gz: 0a5bbbfdc1d36cc49cbb31bb4470053dbcd6469eb266360f795bd80d19c84007e06558fcf3eca6b41b0296cb21e8348e099cdda75cdf280edc057225e87b5f5c
7
+ data.tar.gz: a87315e680f06540fc1f34a66c2cba360542282a9f69774563442e6388b32f83e54bd29cf102ee7c542f06fd7577a035e36c96d57830719a6d1bc9032f9dccbe
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Release History: opentelemetry-instrumentation-excon
2
2
 
3
+ ### v0.28.0 / 2026-03-17
4
+
5
+ * BREAKING CHANGE: Default to stable HTTP semantic conventions (#2051)
6
+ * ADDED: Default to stable HTTP semantic conventions (#2051)
7
+
8
+ ### v0.27.0 / 2026-01-13
9
+
10
+ * ADDED: HTTP Client Semconv v1.17 Span Naming
11
+
3
12
  ### v0.26.1 / 2025-11-25
4
13
 
5
14
  * FIXED: Update support for unknown HTTP methods to match semantic conventions
@@ -7,7 +16,6 @@
7
16
  ### v0.26.0 / 2025-10-22
8
17
 
9
18
  * BREAKING CHANGE: Min Ruby Version 3.2
10
-
11
19
  * ADDED: Min Ruby Version 3.2
12
20
 
13
21
  ### v0.25.2 / 2025-10-11
@@ -29,7 +37,6 @@
29
37
  ### v0.23.0 / 2025-01-16
30
38
 
31
39
  * BREAKING CHANGE: Set minimum supported version to Ruby 3.1
32
-
33
40
  * ADDED: Set minimum supported version to Ruby 3.1
34
41
 
35
42
  ### v0.22.5 / 2024-11-26
@@ -56,7 +63,6 @@
56
63
  ### v0.22.0 / 2023-11-28
57
64
 
58
65
  * BREAKING CHANGE: Add a connect span to excon
59
-
60
66
  * ADDED: Add a connect span to excon
61
67
 
62
68
  ### v0.21.3 / 2023-11-23
@@ -74,7 +80,6 @@
74
80
  ### v0.21.0 / 2023-04-17
75
81
 
76
82
  * BREAKING CHANGE: Drop support for EoL Ruby 2.7
77
-
78
83
  * ADDED: Drop support for EoL Ruby 2.7
79
84
 
80
85
  ### v0.20.1 / 2023-01-14
@@ -110,7 +115,6 @@
110
115
  ### v0.19.0 / 2021-06-23
111
116
 
112
117
  * BREAKING CHANGE: Total order constraint on span.status=
113
-
114
118
  * FIXED: Total order constraint on span.status=
115
119
 
116
120
  ### v0.18.0 / 2021-05-21
@@ -135,7 +139,6 @@
135
139
  ### v0.14.0 / 2021-02-03
136
140
 
137
141
  * BREAKING CHANGE: Replace getter and setter callables and remove rack specific propagators
138
-
139
142
  * ADDED: Replace getter and setter callables and remove rack specific propagators
140
143
 
141
144
  ### v0.13.0 / 2021-01-29
@@ -157,14 +160,12 @@
157
160
  ### v0.9.0 / 2020-11-27
158
161
 
159
162
  * BREAKING CHANGE: Add timeout for force_flush and shutdown
160
-
161
163
  * ADDED: Add timeout for force_flush and shutdown
162
164
 
163
165
  ### v0.8.0 / 2020-10-27
164
166
 
165
167
  * BREAKING CHANGE: Move context/span methods to Trace module
166
168
  * BREAKING CHANGE: Remove 'canonical' from status codes
167
-
168
169
  * FIXED: Move context/span methods to Trace module
169
170
  * FIXED: Remove 'canonical' from status codes
170
171
 
data/README.md CHANGED
@@ -49,19 +49,14 @@ The `opentelemetry-instrumentation-all` gem is distributed under the Apache 2.0
49
49
  [slack-channel]: https://cloud-native.slack.com/archives/C01NWKKMKMY
50
50
  [discussions-url]: https://github.com/open-telemetry/opentelemetry-ruby/discussions
51
51
 
52
-
53
52
  ## HTTP semantic convention stability
54
53
 
55
- In the OpenTelemetry ecosystem, HTTP semantic conventions have now reached a stable state. However, the initial Excon instrumentation was introduced before this stability was achieved, which resulted in HTTP attributes being based on an older version of the semantic conventions.
56
-
57
- 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.
54
+ 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.
58
55
 
59
56
  When setting the value for `OTEL_SEMCONV_STABILITY_OPT_IN`, you can specify which conventions you wish to adopt:
60
57
 
61
- - `http` - Emits the stable HTTP and networking conventions and ceases emitting the old conventions previously emitted by the instrumentation.
62
- - `http/dup` - Emits both the old and stable HTTP and networking conventions, enabling a phased rollout of the stable semantic conventions.
63
- - Default behavior (in the absence of either value) is to continue emitting the old HTTP and networking conventions the instrumentation previously emitted.
64
-
65
- During the transition from old to stable conventions, Excon instrumentation code comes in three patch versions: `dup`, `old`, and `stable`. These versions are identical except for the attributes they send. Any changes to Excon instrumentation should consider all three patches.
58
+ - `http` - Emits the stable HTTP and networking conventions.
59
+ - `http/dup` - **DEPRECATED: Will be removed on April 15, 2026.** Emits both the old and stable HTTP and networking conventions.
60
+ - `old` - **DEPRECATED: Will be removed on April 15, 2026.** Emits the old HTTP and networking conventions.
66
61
 
67
- For additional information on migration, please refer to our [documentation](https://opentelemetry.io/docs/specs/semconv/non-normative/http-migration/).
62
+ For additional information on migration, please refer to our [documentation](https://opentelemetry.io/docs/specs/semconv/non-normative/http-migration/).
@@ -10,8 +10,8 @@ module OpenTelemetry
10
10
  # Utility module for HTTP-related helper methods
11
11
  # @api private
12
12
  module HttpHelper
13
- # Lightweight struct to hold span creation attributes
14
- SpanCreationAttributes = Struct.new(:span_name, :normalized_method, :original_method, keyword_init: true)
13
+ # Lightweight struct to hold span creation data
14
+ SpanCreationAttributes = Struct.new(:span_name, :attributes)
15
15
 
16
16
  # Pre-computed mapping to avoid string allocations during normalization
17
17
  METHOD_CACHE = {
@@ -44,41 +44,89 @@ module OpenTelemetry
44
44
  :trace => 'TRACE'
45
45
  }.freeze
46
46
 
47
- # Pre-computed span names for old semantic conventions to avoid allocations
48
- OLD_SPAN_NAMES = {
49
- 'CONNECT' => 'HTTP CONNECT',
50
- 'DELETE' => 'HTTP DELETE',
51
- 'GET' => 'HTTP GET',
52
- 'HEAD' => 'HTTP HEAD',
53
- 'OPTIONS' => 'HTTP OPTIONS',
54
- 'PATCH' => 'HTTP PATCH',
55
- 'POST' => 'HTTP POST',
56
- 'PUT' => 'HTTP PUT',
57
- 'TRACE' => 'HTTP TRACE'
58
- }.freeze
47
+ private_constant :METHOD_CACHE
48
+
49
+ OLD_SPAN_NAMES_BY_METHOD = METHOD_CACHE.values.uniq.to_h do |method|
50
+ [method, "HTTP #{method}"]
51
+ end.freeze
59
52
 
60
- private_constant :METHOD_CACHE, :OLD_SPAN_NAMES
53
+ private_constant :OLD_SPAN_NAMES_BY_METHOD
61
54
 
62
- # Prepares all span data for the specified semantic convention in a single call
55
+ # Prepares span data using old semantic conventions
63
56
  # @param method [String, Symbol] The HTTP method
64
- # @param semconv [Symbol] The semantic convention to use (:stable or :old)
65
- # @return [SpanCreationAttributes] struct containing span_name, normalized_method, and original_method
66
- def self.span_attrs_for(method, semconv: :stable)
57
+ # @return [SpanCreationAttributes] struct containing span_name and attributes hash
58
+ def self.span_attrs_for_old(method)
59
+ client_context_attrs = OpenTelemetry::Common::HTTP::ClientContext.attributes
67
60
  normalized = METHOD_CACHE[method]
61
+ attributes = client_context_attrs.dup
62
+
63
+ # Determine base span name and method value
64
+ if normalized
65
+ span_name = OLD_SPAN_NAMES_BY_METHOD[normalized]
66
+ method_value = normalized
67
+ else
68
+ span_name = 'HTTP'
69
+ method_value = '_OTHER'
70
+ end
71
+
72
+ attributes['http.method'] ||= method_value
73
+
74
+ SpanCreationAttributes.new(span_name: span_name, attributes: attributes)
75
+ end
76
+
77
+ # Prepares span data using stable semantic conventions
78
+ # @param method [String, Symbol] The HTTP method
79
+ # @return [SpanCreationAttributes] struct containing span_name and attributes hash
80
+ def self.span_attrs_for_stable(method)
81
+ client_context_attrs = OpenTelemetry::Common::HTTP::ClientContext.attributes
82
+ url_template = client_context_attrs['url.template']
83
+ normalized = METHOD_CACHE[method]
84
+ attributes = client_context_attrs.dup
85
+
86
+ # Determine base span name and method value
68
87
  if normalized
69
- span_name = semconv == :old ? OLD_SPAN_NAMES[normalized] : normalized
70
- SpanCreationAttributes.new(
71
- span_name: span_name,
72
- normalized_method: normalized,
73
- original_method: nil
74
- )
88
+ base_name = normalized
89
+ method_value = normalized
90
+ original = nil
75
91
  else
76
- SpanCreationAttributes.new(
77
- span_name: 'HTTP',
78
- normalized_method: '_OTHER',
79
- original_method: method.to_s
80
- )
92
+ base_name = 'HTTP'
93
+ method_value = '_OTHER'
94
+ original = method.to_s
81
95
  end
96
+
97
+ span_name = url_template ? "#{base_name} #{url_template}" : base_name
98
+ attributes['http.request.method'] ||= method_value
99
+ attributes['http.request.method_original'] ||= original if original
100
+
101
+ SpanCreationAttributes.new(span_name: span_name, attributes: attributes)
102
+ end
103
+
104
+ # Prepares span data using both old and stable semantic conventions
105
+ # @param method [String, Symbol] The HTTP method
106
+ # @return [SpanCreationAttributes] struct containing span_name and attributes hash
107
+ def self.span_attrs_for_dup(method)
108
+ client_context_attrs = OpenTelemetry::Common::HTTP::ClientContext.attributes
109
+ url_template = client_context_attrs['url.template']
110
+ normalized = METHOD_CACHE[method]
111
+ attributes = client_context_attrs.dup
112
+
113
+ # Determine base span name and method value
114
+ if normalized
115
+ base_name = normalized
116
+ method_value = normalized
117
+ original = nil
118
+ else
119
+ base_name = 'HTTP'
120
+ method_value = '_OTHER'
121
+ original = method.to_s
122
+ end
123
+
124
+ span_name = url_template ? "#{base_name} #{url_template}" : base_name
125
+ attributes['http.method'] ||= method_value
126
+ attributes['http.request.method'] ||= method_value
127
+ attributes['http.request.method_original'] ||= original if original
128
+
129
+ SpanCreationAttributes.new(span_name: span_name, attributes: attributes)
82
130
  end
83
131
  end
84
132
  end
@@ -34,14 +34,20 @@ module OpenTelemetry
34
34
  values = stability_opt_in.split(',').map(&:strip)
35
35
 
36
36
  if values.include?('http/dup')
37
+ emit_old_semconv_deprecation_warning('http/dup')
37
38
  'dup'
38
- elsif values.include?('http')
39
- 'stable'
40
- else
39
+ elsif values.include?('old')
40
+ emit_old_semconv_deprecation_warning('old')
41
41
  'old'
42
+ else
43
+ 'stable'
42
44
  end
43
45
  end
44
46
 
47
+ def emit_old_semconv_deprecation_warning(option)
48
+ 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.")
49
+ end
50
+
45
51
  def require_dependencies_dup
46
52
  require_relative 'middlewares/dup/tracer_middleware'
47
53
  require_relative 'patches/dup/socket'
@@ -17,29 +17,26 @@ module OpenTelemetry
17
17
  def request_call(datum)
18
18
  return @stack.request_call(datum) if untraced?(datum)
19
19
 
20
- span_data = HttpHelper.span_attrs_for(datum[:method])
20
+ span_data = HttpHelper.span_attrs_for_dup(datum[:method])
21
21
 
22
22
  cleansed_url = OpenTelemetry::Common::Utilities.cleanse_url(::Excon::Utils.request_uri(datum))
23
23
  attributes = {
24
24
  OpenTelemetry::SemanticConventions::Trace::HTTP_HOST => datum[:host],
25
- OpenTelemetry::SemanticConventions::Trace::HTTP_METHOD => span_data.normalized_method,
26
25
  OpenTelemetry::SemanticConventions::Trace::HTTP_SCHEME => datum[:scheme],
27
26
  OpenTelemetry::SemanticConventions::Trace::HTTP_TARGET => datum[:path],
28
27
  OpenTelemetry::SemanticConventions::Trace::HTTP_URL => cleansed_url,
29
28
  OpenTelemetry::SemanticConventions::Trace::NET_PEER_NAME => datum[:hostname],
30
29
  OpenTelemetry::SemanticConventions::Trace::NET_PEER_PORT => datum[:port],
31
- 'http.request.method' => span_data.normalized_method,
32
30
  'url.scheme' => datum[:scheme],
33
31
  'url.path' => datum[:path],
34
32
  'url.full' => cleansed_url,
35
33
  'server.address' => datum[:hostname],
36
34
  'server.port' => datum[:port]
37
35
  }
38
- attributes['http.request.method_original'] = span_data.original_method if span_data.original_method
39
36
  attributes['url.query'] = datum[:query] if datum[:query]
40
37
  peer_service = Excon::Instrumentation.instance.config[:peer_service]
41
38
  attributes[OpenTelemetry::SemanticConventions::Trace::PEER_SERVICE] = peer_service if peer_service
42
- attributes.merge!(OpenTelemetry::Common::HTTP::ClientContext.attributes)
39
+ attributes.merge!(span_data.attributes)
43
40
  span = tracer.start_span(span_data.span_name, attributes: attributes, kind: :client)
44
41
  ctx = OpenTelemetry::Trace.context_with_span(span)
45
42
  datum[:otel_span] = span
@@ -17,11 +17,10 @@ module OpenTelemetry
17
17
  def request_call(datum)
18
18
  return @stack.request_call(datum) if untraced?(datum)
19
19
 
20
- span_data = HttpHelper.span_attrs_for(datum[:method], semconv: :old)
20
+ span_data = HttpHelper.span_attrs_for_old(datum[:method])
21
21
 
22
22
  attributes = {
23
23
  OpenTelemetry::SemanticConventions::Trace::HTTP_HOST => datum[:host],
24
- OpenTelemetry::SemanticConventions::Trace::HTTP_METHOD => span_data.normalized_method,
25
24
  OpenTelemetry::SemanticConventions::Trace::HTTP_SCHEME => datum[:scheme],
26
25
  OpenTelemetry::SemanticConventions::Trace::HTTP_TARGET => datum[:path],
27
26
  OpenTelemetry::SemanticConventions::Trace::HTTP_URL => OpenTelemetry::Common::Utilities.cleanse_url(::Excon::Utils.request_uri(datum)),
@@ -30,7 +29,7 @@ module OpenTelemetry
30
29
  }
31
30
  peer_service = Excon::Instrumentation.instance.config[:peer_service]
32
31
  attributes[OpenTelemetry::SemanticConventions::Trace::PEER_SERVICE] = peer_service if peer_service
33
- attributes.merge!(OpenTelemetry::Common::HTTP::ClientContext.attributes)
32
+ attributes.merge!(span_data.attributes)
34
33
  span = tracer.start_span(span_data.span_name, attributes: attributes, kind: :client)
35
34
  ctx = OpenTelemetry::Trace.context_with_span(span)
36
35
  datum[:otel_span] = span
@@ -17,21 +17,17 @@ module OpenTelemetry
17
17
  def request_call(datum)
18
18
  return @stack.request_call(datum) if untraced?(datum)
19
19
 
20
- span_data = HttpHelper.span_attrs_for(datum[:method])
20
+ span_data = HttpHelper.span_attrs_for_stable(datum[:method])
21
21
 
22
- attributes = {
23
- 'http.request.method' => span_data.normalized_method,
24
- 'url.scheme' => datum[:scheme],
25
- 'url.path' => datum[:path],
26
- 'url.full' => OpenTelemetry::Common::Utilities.cleanse_url(::Excon::Utils.request_uri(datum)),
27
- 'server.address' => datum[:hostname],
28
- 'server.port' => datum[:port]
29
- }
30
- attributes['http.request.method_original'] = span_data.original_method if span_data.original_method
22
+ attributes = { 'url.scheme' => datum[:scheme],
23
+ 'url.path' => datum[:path],
24
+ 'url.full' => OpenTelemetry::Common::Utilities.cleanse_url(::Excon::Utils.request_uri(datum)),
25
+ 'server.address' => datum[:hostname],
26
+ 'server.port' => datum[:port] }
31
27
  attributes['url.query'] = datum[:query] if datum[:query]
32
28
  peer_service = Excon::Instrumentation.instance.config[:peer_service]
33
29
  attributes[OpenTelemetry::SemanticConventions::Trace::PEER_SERVICE] = peer_service if peer_service
34
- attributes.merge!(OpenTelemetry::Common::HTTP::ClientContext.attributes)
30
+ attributes.merge!(span_data.attributes)
35
31
  span = tracer.start_span(span_data.span_name, attributes: attributes, kind: :client)
36
32
  ctx = OpenTelemetry::Trace.context_with_span(span)
37
33
  datum[:otel_span] = span
@@ -7,7 +7,7 @@
7
7
  module OpenTelemetry
8
8
  module Instrumentation
9
9
  module Excon
10
- VERSION = '0.26.1'
10
+ VERSION = '0.28.0'
11
11
  end
12
12
  end
13
13
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opentelemetry-instrumentation-excon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.26.1
4
+ version: 0.28.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
@@ -52,11 +51,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
52
51
  licenses:
53
52
  - Apache-2.0
54
53
  metadata:
55
- changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-excon/0.26.1/file/CHANGELOG.md
54
+ changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-excon/0.28.0/file/CHANGELOG.md
56
55
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation/excon
57
56
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
58
- documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-excon/0.26.1
59
- post_install_message:
57
+ documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-excon/0.28.0
60
58
  rdoc_options: []
61
59
  require_paths:
62
60
  - lib
@@ -71,8 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
69
  - !ruby/object:Gem::Version
72
70
  version: '0'
73
71
  requirements: []
74
- rubygems_version: 3.4.19
75
- signing_key:
72
+ rubygems_version: 4.0.3
76
73
  specification_version: 4
77
74
  summary: Excon instrumentation for the OpenTelemetry framework
78
75
  test_files: []