lib/opentelemetry/sdk/trace/export/batch_span_processor.rb in opentelemetry-sdk-0.11.1 vs lib/opentelemetry/sdk/trace/export/batch_span_processor.rb in opentelemetry-sdk-0.12.0
- old
+ new
@@ -76,12 +76,14 @@
return unless span.context.trace_flags.sampled?
lock do
reset_on_fork
n = spans.size + 1 - max_queue_size
- spans.shift(n) if n.positive?
- report_dropped_spans(n, reason: 'buffer-full')
+ if n.positive?
+ spans.shift(n)
+ report_dropped_spans(n, reason: 'buffer-full')
+ end
spans << span
@condition.signal if spans.size > batch_size
end
end
@@ -185,10 +187,10 @@
def report_result(result_code, batch)
if result_code == SUCCESS
@metrics_reporter.add_to_counter('otel.bsp.export.success')
@metrics_reporter.add_to_counter('otel.bsp.exported_spans', increment: batch.size)
else
- OpenTelemetry.logger.error("Unable to export #{batch.size} spans")
+ OpenTelemetry.handle_error(message: "Unable to export #{batch.size} spans")
@metrics_reporter.add_to_counter('otel.bsp.export.failure')
report_dropped_spans(batch.size, reason: 'export-failure')
end
end