Skip to content

Commit b858031

Browse files
authored
feat: add explicit BSP export error (#871)
1 parent f0738fa commit b858031

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

sdk/lib/opentelemetry/sdk/trace/export.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ module Trace
1010
# The Export module contains the built-in exporters and span processors for the OpenTelemetry
1111
# reference implementation.
1212
module Export
13+
ExportError = Class.new(OpenTelemetry::Error)
14+
1315
# Result codes for the SpanExporter#export method and the SpanProcessor#force_flush and SpanProcessor#shutdown methods.
1416

1517
# The operation finished successfully.

sdk/lib/opentelemetry/sdk/trace/export/batch_span_processor.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def report_result(result_code, batch)
194194
@metrics_reporter.add_to_counter('otel.bsp.export.success')
195195
@metrics_reporter.add_to_counter('otel.bsp.exported_spans', increment: batch.size)
196196
else
197-
OpenTelemetry.handle_error(message: "Unable to export #{batch.size} spans")
197+
OpenTelemetry.handle_error(exception: ExportError.new("Unable to export #{batch.size} spans"))
198198
@metrics_reporter.add_to_counter('otel.bsp.export.failure')
199199
report_dropped_spans(batch.size, reason: 'export-failure')
200200
end

0 commit comments

Comments
 (0)