opentelemetry-sdk 1.3.2 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef291be552aa487d0348eeadee291923710eb8621f74b552d41835f480056869
4
- data.tar.gz: 84ccd40e5b33a3a7a4c0c90b265e87708f3f42ba843166b39d2282aa5eb2382a
3
+ metadata.gz: 83a673caf48821ecaaebd3bf954cc674b720eee1727eff03b5094ecd4338971c
4
+ data.tar.gz: 3fb2937947b640cc86e4ae7d56137bf4cf6683e4f11e378002a56ca8c45506d5
5
5
  SHA512:
6
- metadata.gz: 43c4598b75aaeea2c46e89c72db0bc10b2a78a9a9d553c3bf777d65dc0b80a8cdab4d3c0c52f05fa9fdf691a4e3e8e8cb5e808c4d762fdca7cfa0832ee6dd1a1
7
- data.tar.gz: c4e434f89f6a8ee8207b8036e31147db0ea9bf4931bb6130db120c6b6a0b78a93ca32e17bf1316a1b56f6162724335716cfaaf34b6b046a1df28be22de4b9653
6
+ metadata.gz: e3f0135a67fffcb1a50c8d7a639dcd9e02a2b7d8abe61ff9beb3553a2ed1e8d93fbbe08904b46fbbebaa0c913ae6acd3a88c93329168cf00be13f205511bc48f
7
+ data.tar.gz: 7197e47a5a52adabad0f651b3d7b7a9cc3f5b5f4792e64a20790efb69fc20315ab5fef322ff0798eb6e3ee6eb88e8b25429e5412657cc61fcb19496fbbe79de9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Release History: opentelemetry-sdk
2
2
 
3
+ ### v1.4.0 / 2024-01-25
4
+
5
+ * ADDED: Add spans to Trace::ExportError
6
+
3
7
  ### v1.3.2 / 2024-01-23
4
8
 
5
9
  * FIXED: Reduce allocations on GraphQL hot paths
@@ -110,7 +110,7 @@ module OpenTelemetry
110
110
  remaining_timeout = OpenTelemetry::Common::Utilities.maybe_timeout(timeout, start_time)
111
111
  return TIMEOUT if remaining_timeout&.zero?
112
112
 
113
- batch = snapshot.shift(@batch_size).map!(&:to_span_data)
113
+ batch = snapshot.shift(@batch_size)
114
114
  result_code = export_batch(batch, timeout: remaining_timeout)
115
115
  return result_code unless result_code == SUCCESS
116
116
  end
@@ -125,7 +125,7 @@ module OpenTelemetry
125
125
  dropped_spans = snapshot.shift(n)
126
126
  report_dropped_spans(dropped_spans, reason: 'buffer-full', function: __method__.to_s)
127
127
  end
128
- spans.unshift(snapshot) unless snapshot.empty?
128
+ spans.unshift(*snapshot) unless snapshot.empty?
129
129
  @condition.signal if spans.size > max_queue_size / 2
130
130
  end
131
131
  end
@@ -162,7 +162,7 @@ module OpenTelemetry
162
162
  @condition.wait(@mutex, @delay_seconds) while spans.empty? && @keep_running
163
163
  return unless @keep_running
164
164
 
165
- fetch_batch
165
+ spans.shift(@batch_size)
166
166
  end
167
167
 
168
168
  @metrics_reporter.observe_value('otel.bsp.buffer_utilization', value: spans.size / max_queue_size.to_f)
@@ -183,24 +183,25 @@ module OpenTelemetry
183
183
  OpenTelemetry.handle_error(exception: e, message: 'unexpected error in BatchSpanProcessor#reset_on_fork')
184
184
  end
185
185
 
186
- def export_batch(batch, timeout: @exporter_timeout_seconds)
186
+ def export_batch(span_array, timeout: @exporter_timeout_seconds)
187
+ batch = span_array.map(&:to_span_data)
187
188
  result_code = @export_mutex.synchronize { @exporter.export(batch, timeout: timeout) }
188
- report_result(result_code, batch)
189
+ report_result(result_code, span_array)
189
190
  result_code
190
191
  rescue StandardError => e
191
- report_result(FAILURE, batch)
192
+ report_result(FAILURE, span_array)
192
193
  @metrics_reporter.add_to_counter('otel.bsp.error', labels: { 'reason' => e.class.to_s })
193
194
  FAILURE
194
195
  end
195
196
 
196
- def report_result(result_code, batch)
197
+ def report_result(result_code, span_array)
197
198
  if result_code == SUCCESS
198
199
  @metrics_reporter.add_to_counter('otel.bsp.export.success')
199
- @metrics_reporter.add_to_counter('otel.bsp.exported_spans', increment: batch.size)
200
+ @metrics_reporter.add_to_counter('otel.bsp.exported_spans', increment: span_array.size)
200
201
  else
201
- OpenTelemetry.handle_error(exception: ExportError.new("Unable to export #{batch.size} spans"))
202
+ OpenTelemetry.handle_error(exception: ExportError.new(span_array))
202
203
  @metrics_reporter.add_to_counter('otel.bsp.export.failure')
203
- report_dropped_spans(batch, reason: 'export-failure')
204
+ report_dropped_spans(span_array, reason: 'export-failure')
204
205
  end
205
206
  end
206
207
 
@@ -208,10 +209,6 @@ module OpenTelemetry
208
209
  @metrics_reporter.add_to_counter('otel.bsp.dropped_spans', increment: dropped_spans.size, labels: { 'reason' => reason, OpenTelemetry::SemanticConventions::Trace::CODE_FUNCTION => function }.compact)
209
210
  end
210
211
 
211
- def fetch_batch
212
- spans.shift(@batch_size).map!(&:to_span_data)
213
- end
214
-
215
212
  def lock
216
213
  @mutex.synchronize do
217
214
  yield
@@ -10,7 +10,19 @@ module OpenTelemetry
10
10
  # The Export module contains the built-in exporters and span processors for the OpenTelemetry
11
11
  # reference implementation.
12
12
  module Export
13
- ExportError = Class.new(OpenTelemetry::Error)
13
+ # Raised when an export fails; spans are available via :spans accessor
14
+ class ExportError < OpenTelemetry::Error
15
+ # Returns the {Span} array for this exception
16
+ #
17
+ # @return [Array<OpenTelemetry::SDK::Trace::Span>]
18
+ attr_reader :spans
19
+
20
+ # @param [Array<OpenTelemetry::SDK::Trace::Span>] spans the array of spans that failed to export
21
+ def initialize(spans)
22
+ super("Unable to export #{spans.size} spans")
23
+ @spans = spans
24
+ end
25
+ end
14
26
 
15
27
  # Result codes for the SpanExporter#export method and the SpanProcessor#force_flush and SpanProcessor#shutdown methods.
16
28
 
@@ -7,6 +7,6 @@
7
7
  module OpenTelemetry
8
8
  module SDK
9
9
  ## Current OpenTelemetry version
10
- VERSION = '1.3.2'
10
+ VERSION = '1.4.0'
11
11
  end
12
12
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opentelemetry-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.4.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: 2024-01-23 00:00:00.000000000 Z
11
+ date: 2024-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -294,10 +294,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
294
294
  licenses:
295
295
  - Apache-2.0
296
296
  metadata:
297
- changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-sdk/v1.3.2/file.CHANGELOG.html
297
+ changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-sdk/v1.4.0/file.CHANGELOG.html
298
298
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/sdk
299
299
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
300
- documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-sdk/v1.3.2
300
+ documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-sdk/v1.4.0
301
301
  post_install_message:
302
302
  rdoc_options: []
303
303
  require_paths: