opentelemetry-api 1.5.0 → 1.7.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: c8e28fbff05b0990f518c27eddbadcbe497f98b4480182b328a6661994536f00
4
- data.tar.gz: 8cbd61f00056f786f58e724eb9c621b7c3b537cd0eb9b86b6059986501b38261
3
+ metadata.gz: 4dbc39ae2e689608cb056105d3c038362070fe52d8ee653de0426f1c55766faf
4
+ data.tar.gz: c9a9c610b7f5f986d18df5e5b3a76d5fed3fcf94067abef7eeaaa79a32fa9a7b
5
5
  SHA512:
6
- metadata.gz: 0bb2f4e8c9713f7d26c03023a204d247d25ff5eb16658543f240d76175146b652229fa0d98e419be574d656c5d359001f505dec51e7085a0296cd41aedb23fd0
7
- data.tar.gz: 427cb2d644361b7163d401ee37c071dc6cbc8b8b0add760b8bfbad4dc1e33de6ac03b210a6d00ef225fc8ff265d6a6340ba7b70ecdc22699d9e60566b72c5ea0
6
+ metadata.gz: e2f0d816874f16b73a7b137a1452beea256834d4ed6b777fe88981ec9216de730b28b07fe23f001b41491f2038be168116fc08b17848f22156b6dc3a584ddf73
7
+ data.tar.gz: b32b57334ebac36284710f5fc1a1e5f3277458b9caa91a94063f104e038bde8238c3293d25598b43ea693d2d2a261f7d9be0a2e285696e5d942ec27ae649893e
data/CHANGELOG.md CHANGED
@@ -1,193 +1,207 @@
1
1
  # Release History: opentelemetry-api
2
2
 
3
+ ### v1.7.0 / 2025-09-17
4
+
5
+ * BREAKING CHANGE: Remove Span APIs for attributes and events
6
+
7
+ * ADDED: Add record_exception option for in_span
8
+ * FIXED: Remove Span APIs for attributes and events
9
+
10
+ ### v1.6.0 / 2025-08-14
11
+
12
+ - ADDED: Add noop methods on Trace::Span for `attributes` and `events`
13
+
3
14
  ### v1.5.0 / 2025-02-20
4
15
 
5
- * ADDED: Suppport 3.1 Min Version
6
- * FIXED: Use a Fiber attribute for Context
16
+ - ADDED: Support 3.1 Min Version
17
+ - FIXED: Use a Fiber attribute for Context
7
18
 
8
19
  ### v1.4.0 / 2024-08-27
9
20
 
10
- * ADDED: Include backtrace first line for better debug info
21
+ - ADDED: Include backtrace first line for better debug info
11
22
 
12
23
  ### v1.3.0 / 2024-07-24
13
24
 
14
- * ADDED: Add add_link to span api/sdk
25
+ - ADDED: Add add_link to span api/sdk
15
26
 
16
27
  ### v1.2.5 / 2024-02-20
17
28
 
18
- * FIXED: Replace Context stack on clear
29
+ - FIXED: Replace Context stack on clear
19
30
 
20
31
  ### v1.2.4 / 2024-02-06
21
32
 
22
- * FIXED: SystemStackError in Composite Text Map Propagator (#1590)
33
+ - FIXED: SystemStackError in Composite Text Map Propagator (#1590)
23
34
 
24
35
  ### v1.2.3 / 2023-09-18
25
36
 
26
- * FIXED: Optimize span and trace ID generation
27
- * FIXED: Small perf improvement to generate_r
37
+ - FIXED: Optimize span and trace ID generation
38
+ - FIXED: Small perf improvement to generate_r
28
39
 
29
40
  ### v1.2.2 / 2023-08-15
30
41
 
31
- * FIXED: Patch the issue for frozen string on ruby < 3.0 with string interpolation
32
- * FIXED: Performance regression in_span
33
- * FIXED: In_span performance
42
+ - FIXED: Patch the issue for frozen string on ruby < 3.0 with string interpolation
43
+ - FIXED: Performance regression in_span
44
+ - FIXED: In_span performance
34
45
 
35
46
  ### v1.2.1 / 2023-07-29
36
47
 
37
- * DOCS: Describe Tracer#in_span arguments
48
+ - DOCS: Describe Tracer#in_span arguments
38
49
 
39
50
  ### v1.2.0 / 2023-06-08
40
51
 
41
- * BREAKING CHANGE: Remove support for EoL Ruby 2.7
52
+ - BREAKING CHANGE: Remove support for EoL Ruby 2.7
42
53
 
43
- * ADDED: Remove support for EoL Ruby 2.7
54
+ - ADDED: Remove support for EoL Ruby 2.7
44
55
 
45
56
  ### v1.1.0 / 2022-09-14
46
57
 
47
- * ADDED: Consistent probability sampler
48
- * FIXED: Get API onto rubocop 1.3
58
+ - ADDED: Consistent probability sampler
59
+ - FIXED: Get API onto rubocop 1.3
49
60
 
50
61
  ### v1.0.2 / 2022-05-02
51
62
 
52
- * FIXED: Text map propagator extraction should use argument context
63
+ - FIXED: Text map propagator extraction should use argument context
53
64
 
54
65
  ### v1.0.1 / 2021-12-01
55
66
 
56
- * FIXED: Deprecate api rack env getter
67
+ - FIXED: Deprecate api rack env getter
57
68
 
58
69
  ### v1.0.0 / 2021-09-29
59
70
 
60
- * (No significant changes)
71
+ - (No significant changes)
61
72
 
62
73
  ### v1.0.0.rc3 / 2021-08-12
63
74
 
64
- * BREAKING CHANGE: Remove optional parent_context from in_span
65
- * BREAKING CHANGE: Refactor Baggage to remove Noop*
66
- * BREAKING CHANGE: Total order constraint on span.status=
67
-
68
- * ADDED: Add Tracer.non_recording_span to API
69
- * ADDED: Make API's NoopTextMapPropagator private
70
- * FIXED: Remove optional parent_context from in_span
71
- * FIXED: Reduce span allocation in API
72
- * FIXED: Refactor Baggage to remove Noop*
73
- * FIXED: Total order constraint on span.status=
74
- * FIXED: Return early if carrier is nil
75
- * FIXED: Update context to match spec
76
- * FIXED: Return the original context if the baggage header value is empty
77
- * DOCS: Update docs to rely more on environment variable configuration
75
+ - BREAKING CHANGE: Remove optional parent_context from in_span
76
+ - BREAKING CHANGE: Refactor Baggage to remove Noop\*
77
+ - BREAKING CHANGE: Total order constraint on span.status=
78
+
79
+ - ADDED: Add Tracer.non_recording_span to API
80
+ - ADDED: Make API's NoopTextMapPropagator private
81
+ - FIXED: Remove optional parent_context from in_span
82
+ - FIXED: Reduce span allocation in API
83
+ - FIXED: Refactor Baggage to remove Noop\*
84
+ - FIXED: Total order constraint on span.status=
85
+ - FIXED: Return early if carrier is nil
86
+ - FIXED: Update context to match spec
87
+ - FIXED: Return the original context if the baggage header value is empty
88
+ - DOCS: Update docs to rely more on environment variable configuration
78
89
 
79
90
  ### v1.0.0.rc2 / 2021-06-23
80
91
 
81
- * BREAKING CHANGE: Remove optional parent_context from in_span [729](https://github.com/open-telemetry/opentelemetry-ruby/pull/729)
82
- * BREAKING CHANGE: Refactor Baggage to remove Noop* [800](https://github.com/open-telemetry/opentelemetry-ruby/pull/800)
92
+ - BREAKING CHANGE: Remove optional parent_context from in_span [729](https://github.com/open-telemetry/opentelemetry-ruby/pull/729)
93
+ - BREAKING CHANGE: Refactor Baggage to remove Noop\* [800](https://github.com/open-telemetry/opentelemetry-ruby/pull/800)
83
94
  - The noop baggage manager has been removed.
84
95
  - The baggage management methods are now available through OpenTelemetry::Baggage#method, previously OpenTelemetry.baggage#method
85
- * BREAKING CHANGE: Total order constraint on span.status= [805](https://github.com/open-telemetry/opentelemetry-ruby/pull/805)
96
+ - BREAKING CHANGE: Total order constraint on span.status= [805](https://github.com/open-telemetry/opentelemetry-ruby/pull/805)
97
+
86
98
  - The OpenTelemetry::Trace::Util::HttpToStatus module has been removed as it was incorrectly setting the span status to OK for codes codes in the range 100..399
87
99
  - The HttpToStatus module can be replaced inline as follows `span.status = OpenTelemetry::Trace::Status.error unless (100..399).include?(response_code.to_i)`
88
100
  - The `Status.new(code, description:)` initializer has been hidden in favour of simpler constructors for each status code: `Status.ok`, `Status.error` and `Status.unset`. Each constructor takes an optional description.
89
101
 
90
- * ADDED: Add Tracer.non_recording_span to API [799](https://github.com/open-telemetry/opentelemetry-ruby/pull/799)
91
- * FIXED: Reduce span allocation in API [795](https://github.com/open-telemetry/opentelemetry-ruby/pull/795)
92
- * FIXED: Return early if carrier is nil [835](https://github.com/open-telemetry/opentelemetry-ruby/pull/835)
93
- * FIXED: Update context to match spec [807](https://github.com/open-telemetry/opentelemetry-ruby/pull/807)
102
+ - ADDED: Add Tracer.non_recording_span to API [799](https://github.com/open-telemetry/opentelemetry-ruby/pull/799)
103
+ - FIXED: Reduce span allocation in API [795](https://github.com/open-telemetry/opentelemetry-ruby/pull/795)
104
+ - FIXED: Return early if carrier is nil [835](https://github.com/open-telemetry/opentelemetry-ruby/pull/835)
105
+ - FIXED: Update context to match spec [807](https://github.com/open-telemetry/opentelemetry-ruby/pull/807)
94
106
  - The `Context.current` setter has been removed and the previously private attach/detach methods are now available as class methods on the context module.
95
107
 
96
108
  ### v1.0.0.rc1 / 2021-05-21
97
109
 
98
- * BREAKING CHANGE: Remove optional parent_context from in_span
110
+ - BREAKING CHANGE: Remove optional parent_context from in_span
99
111
 
100
- * FIXED: Remove optional parent_context from in_span
112
+ - FIXED: Remove optional parent_context from in_span
101
113
 
102
114
  ### v0.17.0 / 2021-04-22
103
115
 
104
- * BREAKING CHANGE: Replace TextMapInjector/TextMapExtractor pairs with a TextMapPropagator.
116
+ - BREAKING CHANGE: Replace TextMapInjector/TextMapExtractor pairs with a TextMapPropagator.
105
117
 
106
118
  [Check the propagator documentation](https://open-telemetry.github.io/opentelemetry-ruby/) for the new usage.
107
- * BREAKING CHANGE: Remove metrics API.
119
+
120
+ - BREAKING CHANGE: Remove metrics API.
108
121
 
109
122
  `OpenTelemetry::Metrics` and all of its behavior removed until spec stabilizes.
110
- * BREAKING CHANGE: Extract instrumentation base from api (#698).
123
+
124
+ - BREAKING CHANGE: Extract instrumentation base from api (#698).
111
125
 
112
126
  To take advantage of a base instrumentation class to create your own auto-instrumentation, require and use the `opentelemetry-instrumentation-base` gem.
113
127
 
114
- * ADDED: Default noop tracer for instrumentation
115
- * FIXED: Refactor propagators to add #fields
116
- * FIXED: Remove metrics API
117
- * FIXED: Dynamically upgrade global tracer provider
128
+ - ADDED: Default noop tracer for instrumentation
129
+ - FIXED: Refactor propagators to add #fields
130
+ - FIXED: Remove metrics API
131
+ - FIXED: Dynamically upgrade global tracer provider
118
132
 
119
133
  ### v0.16.0 / 2021-03-17
120
134
 
121
- * ADDED: Span#add_attributes
122
- * FIXED: Handle rack env getter edge cases
123
- * DOCS: Replace Gitter with GitHub Discussions
135
+ - ADDED: Span#add_attributes
136
+ - FIXED: Handle rack env getter edge cases
137
+ - DOCS: Replace Gitter with GitHub Discussions
124
138
 
125
139
  ### v0.15.0 / 2021-02-18
126
140
 
127
- * ADDED: Add instrumentation config validation
128
- * DOCS: Clarify nil attribute values not allowed
141
+ - ADDED: Add instrumentation config validation
142
+ - DOCS: Clarify nil attribute values not allowed
129
143
 
130
144
  ### v0.14.0 / 2021-02-03
131
145
 
132
- * BREAKING CHANGE: Replace getter and setter callables and remove rack specific propagators
146
+ - BREAKING CHANGE: Replace getter and setter callables and remove rack specific propagators
133
147
 
134
- * ADDED: Replace getter and setter callables and remove rack specific propagators
148
+ - ADDED: Replace getter and setter callables and remove rack specific propagators
135
149
 
136
150
  ### v0.13.0 / 2021-01-29
137
151
 
138
- * ADDED: Add optional attributes to record_exception
139
- * FIXED: Small test fixes.
152
+ - ADDED: Add optional attributes to record_exception
153
+ - FIXED: Small test fixes.
140
154
 
141
155
  ### v0.12.1 / 2021-01-13
142
156
 
143
- * FIXED: Eliminate warning about Random::DEFAULT on Ruby 3.0
157
+ - FIXED: Eliminate warning about Random::DEFAULT on Ruby 3.0
144
158
 
145
159
  ### v0.12.0 / 2020-12-24
146
160
 
147
- * ADDED: Structured error handling
161
+ - ADDED: Structured error handling
148
162
 
149
163
  ### v0.11.0 / 2020-12-11
150
164
 
151
- * BREAKING CHANGE: Implement tracestate
165
+ - BREAKING CHANGE: Implement tracestate
152
166
 
153
- * ADDED: Implement tracestate
154
- * FIXED: Missing white space from install messages
155
- * FIXED: Copyright comments to not reference year
167
+ - ADDED: Implement tracestate
168
+ - FIXED: Missing white space from install messages
169
+ - FIXED: Copyright comments to not reference year
156
170
 
157
171
  ### v0.10.0 / 2020-12-03
158
172
 
159
- * (No significant changes)
173
+ - (No significant changes)
160
174
 
161
175
  ### v0.9.0 / 2020-11-27
162
176
 
163
- * (No significant changes)
177
+ - (No significant changes)
164
178
 
165
179
  ### v0.8.0 / 2020-10-27
166
180
 
167
- * BREAKING CHANGE: Move context/span methods to Trace module
168
- * BREAKING CHANGE: Remove 'canonical' from status codes
169
- * BREAKING CHANGE: Assorted SpanContext fixes
181
+ - BREAKING CHANGE: Move context/span methods to Trace module
182
+ - BREAKING CHANGE: Remove 'canonical' from status codes
183
+ - BREAKING CHANGE: Assorted SpanContext fixes
170
184
 
171
- * ADDED: B3 support
172
- * FIXED: Move context/span methods to Trace module
173
- * FIXED: Remove 'canonical' from status codes
174
- * FIXED: Assorted SpanContext fixes
185
+ - ADDED: B3 support
186
+ - FIXED: Move context/span methods to Trace module
187
+ - FIXED: Remove 'canonical' from status codes
188
+ - FIXED: Assorted SpanContext fixes
175
189
 
176
190
  ### v0.7.0 / 2020-10-07
177
191
 
178
- * FIXED: Safely navigate span variable during error cases
179
- * DOCS: Standardize toplevel docs structure and readme
180
- * DOCS: Fix param description in TextMapInjector for Baggage
192
+ - FIXED: Safely navigate span variable during error cases
193
+ - DOCS: Standardize toplevel docs structure and readme
194
+ - DOCS: Fix param description in TextMapInjector for Baggage
181
195
 
182
196
  ### v0.6.0 / 2020-09-10
183
197
 
184
- * ADDED: Add support for OTEL_LOG_LEVEL env var
185
- * Documented array valued attributes [#343](https://github.com/open-telemetry/opentelemetry-ruby/pull/343)
186
- * Renamed CorrelationContext to Baggage [#338](https://github.com/open-telemetry/opentelemetry-ruby/pull/338)
187
- * Renamed Text* to TextMap* (propagators) [#335](https://github.com/open-telemetry/opentelemetry-ruby/pull/335)
188
- * Fixed exception semantic conventions (`span.record_error` -> `span.record_exception`) [#333](https://github.com/open-telemetry/opentelemetry-ruby/pull/333)
189
- * Removed support for lazy event creation [#329](https://github.com/open-telemetry/opentelemetry-ruby/pull/329)
190
- * `name:` named parameter to `span.add_event` becomes first positional argument
191
- * `Event` class removed from API
192
- * Added `hex_trace_id` and `hex_span_id` helpers to `SpanContext` [#332](https://github.com/open-telemetry/opentelemetry-ruby/pull/332)
193
- * Added `CorrelationContext::Manager.values` method to return correlations as a `Hash` [#323](https://github.com/open-telemetry/opentelemetry-ruby/pull/323)
198
+ - ADDED: Add support for OTEL_LOG_LEVEL env var
199
+ - Documented array valued attributes [#343](https://github.com/open-telemetry/opentelemetry-ruby/pull/343)
200
+ - Renamed CorrelationContext to Baggage [#338](https://github.com/open-telemetry/opentelemetry-ruby/pull/338)
201
+ - Renamed Text* to TextMap* (propagators) [#335](https://github.com/open-telemetry/opentelemetry-ruby/pull/335)
202
+ - Fixed exception semantic conventions (`span.record_error` -> `span.record_exception`) [#333](https://github.com/open-telemetry/opentelemetry-ruby/pull/333)
203
+ - Removed support for lazy event creation [#329](https://github.com/open-telemetry/opentelemetry-ruby/pull/329)
204
+ - `name:` named parameter to `span.add_event` becomes first positional argument
205
+ - `Event` class removed from API
206
+ - Added `hex_trace_id` and `hex_span_id` helpers to `SpanContext` [#332](https://github.com/open-telemetry/opentelemetry-ruby/pull/332)
207
+ - Added `CorrelationContext::Manager.values` method to return correlations as a `Hash` [#323](https://github.com/open-telemetry/opentelemetry-ruby/pull/323)
@@ -26,17 +26,17 @@ module OpenTelemetry
26
26
  # @param attributes [optional Hash] attributes to attach to the span {String => String,
27
27
  # Numeric, Boolean, Array<String, Numeric, Boolean>}
28
28
  # @param links [optional Array] an array of OpenTelemetry::Trace::Link instances
29
- # @param start_timestamp [optional Integer] nanoseconds since Epoch
29
+ # @param start_timestamp [optional Time] timestamp to use as the start time of the span
30
30
  # @param kind [optional Symbol] One of :internal, :server, :client, :producer, :consumer
31
31
  #
32
32
  # @yield [span, context] yields the newly created span and a context containing the
33
33
  # span to the block.
34
- def in_span(name, attributes: nil, links: nil, start_timestamp: nil, kind: nil)
34
+ def in_span(name, attributes: nil, links: nil, start_timestamp: nil, kind: nil, record_exception: true)
35
35
  span = nil
36
36
  span = start_span(name, attributes: attributes, links: links, start_timestamp: start_timestamp, kind: kind)
37
37
  Trace.with_span(span) { |s, c| yield s, c }
38
38
  rescue Exception => e # rubocop:disable Lint/RescueException
39
- span&.record_exception(e)
39
+ span&.record_exception(e) if record_exception
40
40
  span&.status = Status.error("Unhandled exception of type: #{e.class}")
41
41
  raise e
42
42
  ensure
@@ -58,10 +58,13 @@ module OpenTelemetry
58
58
  def start_span(name, with_parent: nil, attributes: nil, links: nil, start_timestamp: nil, kind: nil)
59
59
  span = OpenTelemetry::Trace.current_span(with_parent)
60
60
 
61
- if span.context.valid?
62
- span
61
+ if span.recording?
62
+ OpenTelemetry::Trace.non_recording_span(span.context)
63
63
  else
64
- Span::INVALID
64
+ # Either the span is valid and non-recording, in which case we return it,
65
+ # or there was no span in the Context and Trace.current_span returned Span::INVALID,
66
+ # which is what we're supposed to return.
67
+ span
65
68
  end
66
69
  end
67
70
  end
@@ -6,5 +6,5 @@
6
6
 
7
7
  module OpenTelemetry
8
8
  ## Current OpenTelemetry version
9
- VERSION = '1.5.0'
9
+ VERSION = '1.7.0'
10
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opentelemetry-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenTelemetry Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-02-20 00:00:00.000000000 Z
11
+ date: 2025-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: benchmark-ipsa
@@ -215,10 +215,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
215
215
  licenses:
216
216
  - Apache-2.0
217
217
  metadata:
218
- changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-api/v1.5.0/file.CHANGELOG.html
218
+ changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-api/v1.7.0/file.CHANGELOG.html
219
219
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/api
220
220
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
221
- documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-api/v1.5.0
221
+ documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-api/v1.7.0
222
222
  post_install_message:
223
223
  rdoc_options: []
224
224
  require_paths: