lib/opentelemetry/sdk/trace/export/multi_span_exporter.rb in opentelemetry-sdk-0.17.0 vs lib/opentelemetry/sdk/trace/export/multi_span_exporter.rb in opentelemetry-sdk-1.0.0.rc1
- old
+ new
@@ -24,11 +24,11 @@
# @param [Enumerable<Span>] spans the list of sampled {Span}s to be
# exported.
# @param [optional Numeric] timeout An optional timeout in seconds.
# @return [Integer] the result of the export.
def export(spans, timeout: nil)
- start_time = Time.now
+ start_time = OpenTelemetry::Common::Utilities.timeout_timestamp
results = @span_exporters.map do |span_exporter|
span_exporter.export(spans, timeout: OpenTelemetry::Common::Utilities.maybe_timeout(timeout, start_time))
rescue => e # rubocop:disable Style/RescueStandardError
OpenTelemetry.logger.warn("exception raised by export - #{e}")
FAILURE
@@ -41,11 +41,11 @@
#
# @param [optional Numeric] timeout An optional timeout in seconds.
# @return [Integer] SUCCESS if no error occurred, FAILURE if a
# non-specific failure occurred, TIMEOUT if a timeout occurred.
def force_flush(timeout: nil)
- start_time = Time.now
+ start_time = OpenTelemetry::Common::Utilities.timeout_timestamp
results = @span_exporters.map do |processor|
remaining_timeout = OpenTelemetry::Common::Utilities.maybe_timeout(timeout, start_time)
return TIMEOUT if remaining_timeout&.zero?
processor.force_flush(timeout: remaining_timeout)
@@ -58,10 +58,10 @@
#
# @param [optional Numeric] timeout An optional timeout in seconds.
# @return [Integer] SUCCESS if no error occurred, FAILURE if a
# non-specific failure occurred, TIMEOUT if a timeout occurred.
def shutdown(timeout: nil)
- start_time = Time.now
+ start_time = OpenTelemetry::Common::Utilities.timeout_timestamp
results = @span_exporters.map do |processor|
remaining_timeout = OpenTelemetry::Common::Utilities.maybe_timeout(timeout, start_time)
return TIMEOUT if remaining_timeout&.zero?
processor.shutdown(timeout: remaining_timeout)