lib/opentelemetry/sdk/trace/export/simple_span_processor.rb in opentelemetry-sdk-0.8.0 vs lib/opentelemetry/sdk/trace/export/simple_span_processor.rb in opentelemetry-sdk-0.9.0
- old
+ new
@@ -10,10 +10,16 @@
module Export
# An implementation of the duck type SpanProcessor that converts the
# {Span} to {io.opentelemetry.proto.trace.v1.Span} and passes it to the
# configured exporter.
#
+ # Typically, the SimpleSpanProcessor will be most suitable for use in testing;
+ # it should be used with caution in production. It may be appropriate for
+ # production use in scenarios where creating multiple threads is not desirable
+ # as well as scenarios where different custom attributes should be added to
+ # individual spans based on code scopes.
+ #
# Only spans that are recorded are converted, {OpenTelemetry::Trace::Span#is_recording?} must
# return true.
class SimpleSpanProcessor
# Returns a new {SimpleSpanProcessor} that converts spans to
# proto and forwards them to the given span_exporter.
@@ -60,21 +66,23 @@
# This method should only be called in cases where it is absolutely
# necessary, such as when using some FaaS providers that may suspend
# the process after an invocation, but before the `Processor` exports
# the completed spans.
#
+ # @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
+ def force_flush(timeout: nil)
SUCCESS
end
# Called when {TracerProvider#shutdown} is called.
#
+ # @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
- @span_exporter&.shutdown || SUCCESS
+ def shutdown(timeout: nil)
+ @span_exporter&.shutdown(timeout: timeout) || SUCCESS
end
end
end
end
end