opentelemetry-instrumentation-faraday 0.30.1 → 0.33.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: b877acc5ff0551faa19a4d1a09eb5c95b63e497259369edbe20dc211ef8b3964
4
- data.tar.gz: 7860cb972bcf7747c4d3e97d8b45635beb6c67242bca36afa71ee3b663b4ede2
3
+ metadata.gz: cbd01b9342572f7a48c99b60f7b82e56b5dfb478fc22f3f476274492e0452869
4
+ data.tar.gz: 0b3a7afb0d41cd9e214ea2ec054d27eadbbe7d73ac01e9110f28655330e4cfed
5
5
  SHA512:
6
- metadata.gz: 6660d12e648798d2eb55e8c11eb557d1d7c07a8fe593cb69cd025ae02b0be6a41d6d4a35c19f5a7126bfa5ab4a1b79e239cdea5c35d70f065ecff9865af5feb3
7
- data.tar.gz: d486ff5275318c336dede3e3bd5088a0d7445add80ac4c508735e2a218b8dbdcae5fbca1acf4171411012da56c662056c7e2e2ebd5750f323cecfc7ad82b2fa6
6
+ metadata.gz: 294b33d0eae446eec4d86b2545aa0469388a627abc7fde2a8205eb0adb00a79d79351372436631db3d21701401975cde518100c21c92a5f453bb2a8b92a82213
7
+ data.tar.gz: 33c62fe09e3cd63fd2cd2d10996c051a8f04964ee3e46efc93090b27bd43e9f3574cad1f0c5dafb1108bc1fbf1471fffd66f7c13476028e3a193bd00f270be52
data/CHANGELOG.md CHANGED
@@ -1,199 +1,208 @@
1
1
  # Release History: opentelemetry-instrumentation-faraday
2
2
 
3
- ### v0.30.1 / 2025-11-25
3
+ ## v0.33.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.30.0 / 2025-10-22
9
+ ## v0.32.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.31.0 / 2026-01-13
12
15
 
13
- ### v0.29.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.30.1 / 2025-11-25
16
19
 
17
- ### v0.29.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.30.0 / 2025-10-22
20
23
 
21
- ### v0.28.0 / 2025-08-13
24
+ - BREAKING CHANGE: Min Ruby Version 3.2
25
+ - ADDED: Min Ruby Version 3.2
22
26
 
23
- * ADDED: Add Faraday `OTEL_SEMCONV_STABILITY_OPT_IN` environment variable [#1592](https://github.com/open-telemetry/opentelemetry-ruby-contrib/pull/1592)
27
+ ## v0.29.1 / 2025-09-30
24
28
 
25
- ### v0.27.0 / 2025-06-03
29
+ - FIXED: Min OTel Ruby API 1.7
26
30
 
27
- * ADDED: Suppress internal spans with Faraday instrumentation
31
+ ## v0.29.0 / 2025-09-30
28
32
 
29
- ### v0.26.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.28.0 / 2025-08-13
32
36
 
33
- * ADDED: Set minimum supported version to Ruby 3.1
37
+ - ADDED: Add Faraday `OTEL_SEMCONV_STABILITY_OPT_IN` environment variable [#1592](https://github.com/open-telemetry/opentelemetry-ruby-contrib/pull/1592)
34
38
 
35
- ### v0.25.0 / 2025-01-07
39
+ ## v0.27.0 / 2025-06-03
36
40
 
37
- * ADDED: Faraday Minimum v1.0
41
+ - ADDED: Suppress internal spans with Faraday instrumentation
38
42
 
39
- ### v0.24.8 / 2024-12-17
43
+ ## v0.26.0 / 2025-01-16
40
44
 
41
- * FIXED: Share Faraday Attrs with Adapter Spans
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.24.7 / 2024-11-26
48
+ ## v0.25.0 / 2025-01-07
44
49
 
45
- * CHANGED: Performance Freeze all range objects #1222
50
+ - ADDED: Faraday Minimum v1.0
46
51
 
47
- ### v0.24.6 / 2024-07-23
52
+ ## v0.24.8 / 2024-12-17
48
53
 
49
- * DOCS: Add cspell to CI
54
+ - FIXED: Share Faraday Attrs with Adapter Spans
50
55
 
51
- ### v0.24.5 / 2024-06-20
56
+ ## v0.24.7 / 2024-11-26
52
57
 
53
- * FIXED: Compatibility with Faraday v1
58
+ - CHANGED: Performance Freeze all range objects #1222
54
59
 
55
- ### v0.24.4 / 2024-06-18
60
+ ## v0.24.6 / 2024-07-23
56
61
 
57
- * FIXED: Relax otel common gem constraints
62
+ - DOCS: Add cspell to CI
58
63
 
59
- ### v0.24.3 / 2024-05-09
64
+ ## v0.24.5 / 2024-06-20
60
65
 
61
- * FIXED: Untrace entire request
66
+ - FIXED: Compatibility with Faraday v1
62
67
 
63
- ### v0.24.2 / 2024-04-30
68
+ ## v0.24.4 / 2024-06-18
64
69
 
65
- * FIXED: Bundler conflict warnings
70
+ - FIXED: Relax otel common gem constraints
66
71
 
67
- ### v0.24.1 / 2024-03-22
72
+ ## v0.24.3 / 2024-05-09
68
73
 
69
- * FIXED: Propagate response attributes on Faraday::Error.
74
+ - FIXED: Untrace entire request
70
75
 
71
- ### v0.24.0 / 2024-02-20
76
+ ## v0.24.2 / 2024-04-30
72
77
 
73
- * ADDED: Faraday add support for internal spans
78
+ - FIXED: Bundler conflict warnings
74
79
 
75
- ### v0.23.4 / 2023-11-23
80
+ ## v0.24.1 / 2024-03-22
76
81
 
77
- * CHANGED: Applied Rubocop Performance Recommendations [#727](https://github.com/open-telemetry/opentelemetry-ruby-contrib/pull/727)
82
+ - FIXED: Propagate response attributes on Faraday::Error.
78
83
 
79
- ### v0.23.3 / 2023-10-16
84
+ ## v0.24.0 / 2024-02-20
80
85
 
81
- * FIXED: Omit `nil` `net.peer.name` attributes
86
+ - ADDED: Faraday add support for internal spans
82
87
 
83
- ### v0.23.2 / 2023-07-21
88
+ ## v0.23.4 / 2023-11-23
84
89
 
85
- * ADDED: Update `opentelemetry-common` from [0.19.3 to 0.20.0](https://github.com/open-telemetry/opentelemetry-ruby-contrib/pull/537)
90
+ - CHANGED: Applied Rubocop Performance Recommendations [#727](https://github.com/open-telemetry/opentelemetry-ruby-contrib/pull/727)
86
91
 
87
- ### v0.23.1 / 2023-06-05
92
+ ## v0.23.3 / 2023-10-16
88
93
 
89
- * FIXED: Base config options
94
+ - FIXED: Omit `nil` `net.peer.name` attributes
90
95
 
91
- ### v0.23.0 / 2023-04-17
96
+ ## v0.23.2 / 2023-07-21
92
97
 
93
- * BREAKING CHANGE: Drop support for EoL Ruby 2.7
98
+ - ADDED: Update `opentelemetry-common` from [0.19.3 to 0.20.0](https://github.com/open-telemetry/opentelemetry-ruby-contrib/pull/537)
94
99
 
95
- * ADDED: Drop support for EoL Ruby 2.7
100
+ ## v0.23.1 / 2023-06-05
96
101
 
97
- ### v0.22.0 / 2023-01-14
102
+ - FIXED: Base config options
98
103
 
99
- * ADDED: Add request/response hooks to more http clients
100
- * FIXED: Stop leaking basic authentication credentials in Faraday instrumentation
101
- * DOCS: Fix gem homepage
102
- * DOCS: More gem documentation fixes
104
+ ## v0.23.0 / 2023-04-17
103
105
 
104
- ### v0.21.0 / 2022-06-09
106
+ - BREAKING CHANGE: Drop support for EoL Ruby 2.7
107
+ - ADDED: Drop support for EoL Ruby 2.7
105
108
 
106
- * Upgrading Base dependency version
107
- * FIXED: Broken test file requirements
109
+ ## v0.22.0 / 2023-01-14
108
110
 
109
- ### v0.20.1 / 2022-05-03
111
+ - ADDED: Add request/response hooks to more http clients
112
+ - FIXED: Stop leaking basic authentication credentials in Faraday instrumentation
113
+ - DOCS: Fix gem homepage
114
+ - DOCS: More gem documentation fixes
110
115
 
111
- * (No significant changes)
116
+ ## v0.21.0 / 2022-06-09
112
117
 
113
- ### v0.20.0 / 2022-02-02
118
+ - Upgrading Base dependency version
119
+ - FIXED: Broken test file requirements
114
120
 
115
- * ADDED: Add net.peer.name to faraday instrumentation
116
- * FIXED: Excessive hash creation on context attr merging
121
+ ## v0.20.1 / 2022-05-03
117
122
 
118
- ### v0.19.3 / 2021-12-02
123
+ - (No significant changes)
119
124
 
120
- * (No significant changes)
125
+ ## v0.20.0 / 2022-02-02
121
126
 
122
- ### v0.19.2 / 2021-09-29
127
+ - ADDED: Add net.peer.name to faraday instrumentation
128
+ - FIXED: Excessive hash creation on context attr merging
123
129
 
124
- * (No significant changes)
130
+ ## v0.19.3 / 2021-12-02
125
131
 
126
- ### v0.19.1 / 2021-08-12
132
+ - (No significant changes)
127
133
 
128
- * DOCS: Update docs to rely more on environment variable configuration
134
+ ## v0.19.2 / 2021-09-29
129
135
 
130
- ### v0.19.0 / 2021-06-23
136
+ - (No significant changes)
131
137
 
132
- * BREAKING CHANGE: Total order constraint on span.status=
138
+ ## v0.19.1 / 2021-08-12
133
139
 
134
- * FIXED: Total order constraint on span.status=
140
+ - DOCS: Update docs to rely more on environment variable configuration
135
141
 
136
- ### v0.18.1 / 2021-06-08
142
+ ## v0.19.0 / 2021-06-23
137
143
 
138
- * FIXED: Missing require to common in faraday
144
+ - BREAKING CHANGE: Total order constraint on span.status=
145
+ - FIXED: Total order constraint on span.status=
139
146
 
140
- ### v0.18.0 / 2021-05-21
147
+ ## v0.18.1 / 2021-06-08
141
148
 
142
- * ADDED: Updated API dependency for 1.0.0.rc1
143
- * FIXED: Removed http.status_text attribute #750
149
+ - FIXED: Missing require to common in faraday
144
150
 
145
- ### v0.17.0 / 2021-04-22
151
+ ## v0.18.0 / 2021-05-21
146
152
 
147
- * FIXED: Fix Faraday gem dependencies.
148
- * FIXED: Refactor propagators to add #fields
153
+ - ADDED: Updated API dependency for 1.0.0.rc1
154
+ - FIXED: Removed http.status_text attribute #750
149
155
 
150
- ### v0.16.0 / 2021-03-17
156
+ ## v0.17.0 / 2021-04-22
151
157
 
152
- * FIXED: Remove passwords from http.url
153
- * FIXED: Example scripts now reference local common lib
154
- * DOCS: Replace Gitter with GitHub Discussions
158
+ - FIXED: Fix Faraday gem dependencies.
159
+ - FIXED: Refactor propagators to add #fields
155
160
 
156
- ### v0.15.0 / 2021-02-18
161
+ ## v0.16.0 / 2021-03-17
157
162
 
158
- * FIXED: Include http.status_text only if reason_phrase is in the response
163
+ - FIXED: Remove passwords from http.url
164
+ - FIXED: Example scripts now reference local common lib
165
+ - DOCS: Replace Gitter with GitHub Discussions
159
166
 
160
- ### v0.14.0 / 2021-02-03
167
+ ## v0.15.0 / 2021-02-18
161
168
 
162
- * BREAKING CHANGE: Replace getter and setter callables and remove rack specific propagators
169
+ - FIXED: Include http.status_text only if reason_phrase is in the response
163
170
 
164
- * ADDED: Replace getter and setter callables and remove rack specific propagators
171
+ ## v0.14.0 / 2021-02-03
165
172
 
166
- ### v0.13.0 / 2021-01-29
173
+ - BREAKING CHANGE: Replace getter and setter callables and remove rack specific propagators
174
+ - ADDED: Replace getter and setter callables and remove rack specific propagators
167
175
 
168
- * (No significant changes)
176
+ ## v0.13.0 / 2021-01-29
169
177
 
170
- ### v0.12.0 / 2020-12-24
178
+ - (No significant changes)
171
179
 
172
- * (No significant changes)
180
+ ## v0.12.0 / 2020-12-24
173
181
 
174
- ### v0.11.0 / 2020-12-11
182
+ - (No significant changes)
175
183
 
176
- * FIXED: Copyright comments to not reference year
184
+ ## v0.11.0 / 2020-12-11
177
185
 
178
- ### v0.10.0 / 2020-12-03
186
+ - FIXED: Copyright comments to not reference year
179
187
 
180
- * (No significant changes)
188
+ ## v0.10.0 / 2020-12-03
181
189
 
182
- ### v0.9.0 / 2020-11-27
190
+ - (No significant changes)
183
191
 
184
- * BREAKING CHANGE: Add timeout for force_flush and shutdown
192
+ ## v0.9.0 / 2020-11-27
185
193
 
186
- * ADDED: Add timeout for force_flush and shutdown
194
+ - BREAKING CHANGE: Add timeout for force_flush and shutdown
195
+ - ADDED: Add timeout for force_flush and shutdown
187
196
 
188
- ### v0.8.0 / 2020-10-27
197
+ ## v0.8.0 / 2020-10-27
189
198
 
190
- * (No significant changes)
199
+ - (No significant changes)
191
200
 
192
- ### v0.7.0 / 2020-10-07
201
+ ## v0.7.0 / 2020-10-07
193
202
 
194
- * DOCS: Faraday documentation
195
- * DOCS: Standardize top-level docs structure and readme
203
+ - DOCS: Faraday documentation
204
+ - DOCS: Standardize top-level docs structure and readme
196
205
 
197
- ### v0.6.0 / 2020-09-10
206
+ ## v0.6.0 / 2020-09-10
198
207
 
199
- * (No significant changes)
208
+ - (No significant changes)
data/README.md CHANGED
@@ -33,9 +33,11 @@ end
33
33
  ```
34
34
 
35
35
  ### Configuration options
36
- This instrumentation offers the following configuration options:
37
- * `enable_internal_instrumentation` (default: `false`): When set to `true`, any spans with
38
- span kind of `internal` are included in traces.
36
+
37
+ This instrumentation offers the following configuration options:
38
+
39
+ - `enable_internal_instrumentation` (default: `false`): When set to `true`, any spans with
40
+ span kind of `internal` are included in traces.
39
41
 
40
42
  ## Examples
41
43
 
@@ -62,16 +64,12 @@ Apache 2.0 license. See [LICENSE][license-github] for more information.
62
64
 
63
65
  ## HTTP semantic convention stability
64
66
 
65
- In the OpenTelemetry ecosystem, HTTP semantic conventions have now reached a stable state. However, the initial Faraday instrumentation was introduced before this stability was achieved, which resulted in HTTP attributes being based on an older version of the semantic conventions.
66
-
67
- 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.
67
+ 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.
68
68
 
69
69
  When setting the value for `OTEL_SEMCONV_STABILITY_OPT_IN`, you can specify which conventions you wish to adopt:
70
70
 
71
- - `http` - Emits the stable HTTP and networking conventions and ceases emitting the old conventions previously emitted by the instrumentation.
72
- - `http/dup` - Emits both the old and stable HTTP and networking conventions, enabling a phased rollout of the stable semantic conventions.
73
- - Default behavior (in the absence of either value) is to continue emitting the old HTTP and networking conventions the instrumentation previously emitted.
74
-
75
- During the transition from old to stable conventions, Faraday instrumentation code comes in three patch versions: `dup`, `old`, and `stable`. These versions are identical except for the attributes they send. Any changes to Faraday instrumentation should consider all three patches.
71
+ - `http` - Emits the stable HTTP and networking conventions.
72
+ - `http/dup` - **DEPRECATED: Will be removed on April 15, 2026.** Emits both the old and stable HTTP and networking conventions.
73
+ - `old` - **DEPRECATED: Will be removed on April 15, 2026.** Emits the old HTTP and networking conventions.
76
74
 
77
75
  For additional information on migration, please refer to our [documentation](https://opentelemetry.io/docs/specs/semconv/non-normative/http-migration/).
@@ -11,7 +11,7 @@ module OpenTelemetry
11
11
  # @api private
12
12
  module HttpHelper
13
13
  # Lightweight struct to hold span creation attributes
14
- SpanCreationAttributes = Struct.new(:span_name, :normalized_method, :original_method, keyword_init: true)
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,91 @@ 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
52
+
53
+ private_constant :OLD_SPAN_NAMES_BY_METHOD
54
+
55
+ module_function
56
+
57
+ # Prepares span data using old semantic conventions
58
+ # @param method [String, Symbol] The HTTP method
59
+ # @return [SpanCreationAttributes] struct containing span_name and attributes hash
60
+ def span_attrs_for_old(method)
61
+ client_context_attrs = OpenTelemetry::Common::HTTP::ClientContext.attributes
62
+ normalized = METHOD_CACHE[method]
63
+ attributes = client_context_attrs.dup
64
+
65
+ # Determine base span name and method value
66
+ if normalized
67
+ span_name = OLD_SPAN_NAMES_BY_METHOD[normalized]
68
+ method_value = normalized
69
+ else
70
+ span_name = 'HTTP'
71
+ method_value = '_OTHER'
72
+ end
73
+
74
+ attributes['http.method'] ||= method_value
75
+
76
+ SpanCreationAttributes.new(span_name: span_name, attributes: attributes)
77
+ end
78
+
79
+ # Prepares span data using stable semantic conventions
80
+ # @param method [String, Symbol] The HTTP method
81
+ # @return [SpanCreationAttributes] struct containing span_name and attributes hash
82
+ def span_attrs_for_stable(method)
83
+ client_context_attrs = OpenTelemetry::Common::HTTP::ClientContext.attributes
84
+ url_template = client_context_attrs['url.template']
85
+ normalized = METHOD_CACHE[method]
86
+ attributes = client_context_attrs.dup
59
87
 
60
- private_constant :METHOD_CACHE, :OLD_SPAN_NAMES
88
+ # Determine base span name and method value
89
+ if normalized
90
+ base_name = normalized
91
+ method_value = normalized
92
+ original = nil
93
+ else
94
+ base_name = 'HTTP'
95
+ method_value = '_OTHER'
96
+ original = method.to_s
97
+ end
61
98
 
62
- # Prepares all span data for the specified semantic convention in a single call
99
+ span_name = url_template ? "#{base_name} #{url_template}" : base_name
100
+ attributes['http.request.method'] ||= method_value
101
+ attributes['http.request.method_original'] ||= original if original
102
+
103
+ SpanCreationAttributes.new(span_name: span_name, attributes: attributes)
104
+ end
105
+
106
+ # Prepares span data using both old and stable semantic conventions
63
107
  # @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)
108
+ # @return [SpanCreationAttributes] struct containing span_name and attributes hash
109
+ def span_attrs_for_dup(method)
110
+ client_context_attrs = OpenTelemetry::Common::HTTP::ClientContext.attributes
111
+ url_template = client_context_attrs['url.template']
67
112
  normalized = METHOD_CACHE[method]
113
+ attributes = client_context_attrs.dup
114
+
115
+ # Determine base span name and method value
68
116
  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
- )
117
+ base_name = normalized
118
+ method_value = normalized
119
+ original = nil
75
120
  else
76
- SpanCreationAttributes.new(
77
- span_name: 'HTTP',
78
- normalized_method: '_OTHER',
79
- original_method: method.to_s
80
- )
121
+ base_name = 'HTTP'
122
+ method_value = '_OTHER'
123
+ original = method.to_s
81
124
  end
125
+
126
+ span_name = url_template ? "#{base_name} #{url_template}" : base_name
127
+ attributes['http.method'] ||= method_value
128
+ attributes['http.request.method'] ||= method_value
129
+ attributes['http.request.method_original'] ||= original if original
130
+
131
+ SpanCreationAttributes.new(span_name: span_name, attributes: attributes)
82
132
  end
83
133
  end
84
134
  end
@@ -42,14 +42,20 @@ module OpenTelemetry
42
42
  values = stability_opt_in.split(',').map(&:strip)
43
43
 
44
44
  if values.include?('http/dup')
45
+ emit_old_semconv_deprecation_warning('http/dup')
45
46
  'dup'
46
- elsif values.include?('http')
47
- 'stable'
48
- else
47
+ elsif values.include?('old')
48
+ emit_old_semconv_deprecation_warning('old')
49
49
  'old'
50
+ else
51
+ 'stable'
50
52
  end
51
53
  end
52
54
 
55
+ def emit_old_semconv_deprecation_warning(option)
56
+ 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.")
57
+ end
58
+
53
59
  def require_dependencies_dup
54
60
  require_relative 'middlewares/dup/tracer_middleware'
55
61
  require_relative 'patches/dup/connection'
@@ -16,16 +16,12 @@ module OpenTelemetry
16
16
  HTTP_STATUS_SUCCESS_RANGE = (100..399)
17
17
 
18
18
  def call(env)
19
- span_data = HttpHelper.span_attrs_for(env.method)
19
+ span_data = HttpHelper.span_attrs_for_dup(env.method)
20
20
 
21
21
  config = Faraday::Instrumentation.instance.config
22
22
 
23
- attributes = span_creation_attributes(
24
- http_method: span_data.normalized_method,
25
- original_method: span_data.original_method,
26
- url: env.url,
27
- config: config
28
- )
23
+ attributes = span_creation_attributes(url: env.url, config: config)
24
+ attributes.merge!(span_data.attributes)
29
25
 
30
26
  OpenTelemetry::Common::HTTP::ClientContext.with_attributes(attributes) do |attrs, _|
31
27
  tracer.in_span(
@@ -50,25 +46,20 @@ module OpenTelemetry
50
46
 
51
47
  private
52
48
 
53
- def span_creation_attributes(http_method:, original_method:, url:, config:)
49
+ def span_creation_attributes(url:, config:)
54
50
  cleansed_url = OpenTelemetry::Common::Utilities.cleanse_url(url.to_s)
55
51
  attrs = {
56
- 'http.method' => http_method,
57
- 'http.request.method' => http_method,
58
52
  'http.url' => cleansed_url,
59
53
  'url.full' => cleansed_url,
60
54
  'faraday.adapter.name' => app.class.name
61
55
  }
62
- attrs['http.request.method_original'] = original_method if original_method
63
56
  if url.host
64
57
  attrs['net.peer.name'] = url.host
65
58
  attrs['server.address'] = url.host
66
59
  end
67
60
  attrs['peer.service'] = config[:peer_service] if config[:peer_service]
68
61
 
69
- attrs.merge!(
70
- OpenTelemetry::Common::HTTP::ClientContext.attributes
71
- )
62
+ attrs
72
63
  end
73
64
 
74
65
  # Versions prior to 1.0 do not define an accessor for app
@@ -16,13 +16,12 @@ module OpenTelemetry
16
16
  HTTP_STATUS_SUCCESS_RANGE = (100..399)
17
17
 
18
18
  def call(env)
19
- span_data = HttpHelper.span_attrs_for(env.method, semconv: :old)
19
+ span_data = HttpHelper.span_attrs_for_old(env.method)
20
20
 
21
21
  config = Faraday::Instrumentation.instance.config
22
22
 
23
- attributes = span_creation_attributes(
24
- http_method: span_data.normalized_method, url: env.url, config: config
25
- )
23
+ attributes = span_creation_attributes(url: env.url, config: config)
24
+ attributes.merge!(span_data.attributes)
26
25
 
27
26
  OpenTelemetry::Common::HTTP::ClientContext.with_attributes(attributes) do |attrs, _|
28
27
  tracer.in_span(
@@ -47,18 +46,15 @@ module OpenTelemetry
47
46
 
48
47
  private
49
48
 
50
- def span_creation_attributes(http_method:, url:, config:)
49
+ def span_creation_attributes(url:, config:)
51
50
  attrs = {
52
- 'http.method' => http_method,
53
51
  'http.url' => OpenTelemetry::Common::Utilities.cleanse_url(url.to_s),
54
52
  'faraday.adapter.name' => app.class.name
55
53
  }
56
54
  attrs['net.peer.name'] = url.host if url.host
57
55
  attrs['peer.service'] = config[:peer_service] if config[:peer_service]
58
56
 
59
- attrs.merge!(
60
- OpenTelemetry::Common::HTTP::ClientContext.attributes
61
- )
57
+ attrs
62
58
  end
63
59
 
64
60
  # Versions prior to 1.0 do not define an accessor for app
@@ -16,16 +16,12 @@ module OpenTelemetry
16
16
  HTTP_STATUS_SUCCESS_RANGE = (100..399)
17
17
 
18
18
  def call(env)
19
- span_data = HttpHelper.span_attrs_for(env.method)
19
+ span_data = HttpHelper.span_attrs_for_stable(env.method)
20
20
 
21
21
  config = Faraday::Instrumentation.instance.config
22
22
 
23
- attributes = span_creation_attributes(
24
- http_method: span_data.normalized_method,
25
- original_method: span_data.original_method,
26
- url: env.url,
27
- config: config
28
- )
23
+ attributes = span_creation_attributes(url: env.url, config: config)
24
+ attributes.merge!(span_data.attributes)
29
25
 
30
26
  OpenTelemetry::Common::HTTP::ClientContext.with_attributes(attributes) do |attrs, _|
31
27
  tracer.in_span(
@@ -50,19 +46,15 @@ module OpenTelemetry
50
46
 
51
47
  private
52
48
 
53
- def span_creation_attributes(http_method:, original_method:, url:, config:)
49
+ def span_creation_attributes(url:, config:)
54
50
  attrs = {
55
- 'http.request.method' => http_method,
56
51
  'url.full' => OpenTelemetry::Common::Utilities.cleanse_url(url.to_s),
57
52
  'faraday.adapter.name' => app.class.name
58
53
  }
59
- attrs['http.request.method_original'] = original_method if original_method
60
54
  attrs['server.address'] = url.host if url.host
61
55
  attrs['peer.service'] = config[:peer_service] if config[:peer_service]
62
56
 
63
- attrs.merge!(
64
- OpenTelemetry::Common::HTTP::ClientContext.attributes
65
- )
57
+ attrs
66
58
  end
67
59
 
68
60
  # Versions prior to 1.0 do not define an accessor for app
@@ -7,7 +7,7 @@
7
7
  module OpenTelemetry
8
8
  module Instrumentation
9
9
  module Faraday
10
- VERSION = '0.30.1'
10
+ VERSION = '0.33.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-faraday
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.30.1
4
+ version: 0.33.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
@@ -51,11 +50,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
51
50
  licenses:
52
51
  - Apache-2.0
53
52
  metadata:
54
- changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-faraday/0.30.1/file/CHANGELOG.md
55
- source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation/faraday
53
+ changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-faraday/0.33.0/file/CHANGELOG.md
54
+ source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/opentelemetry-instrumentation-faraday/v0.33.0/instrumentation/faraday
56
55
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
57
- documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-faraday/0.30.1
58
- post_install_message:
56
+ documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-faraday/0.33.0
59
57
  rdoc_options: []
60
58
  require_paths:
61
59
  - lib
@@ -63,15 +61,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
63
61
  requirements:
64
62
  - - ">="
65
63
  - !ruby/object:Gem::Version
66
- version: '3.2'
64
+ version: '3.3'
67
65
  required_rubygems_version: !ruby/object:Gem::Requirement
68
66
  requirements:
69
67
  - - ">="
70
68
  - !ruby/object:Gem::Version
71
69
  version: '0'
72
70
  requirements: []
73
- rubygems_version: 3.4.19
74
- signing_key:
71
+ rubygems_version: 4.0.6
75
72
  specification_version: 4
76
73
  summary: Faraday instrumentation for the OpenTelemetry framework
77
74
  test_files: []