lib/opentelemetry/exporter/jaeger/agent_exporter.rb in opentelemetry-exporter-jaeger-0.8.0 vs lib/opentelemetry/exporter/jaeger/agent_exporter.rb in opentelemetry-exporter-jaeger-0.9.0

- old
+ new

@@ -28,24 +28,28 @@ # Called to export sampled {OpenTelemetry::SDK::Trace::SpanData} structs. # # @param [Enumerable<OpenTelemetry::SDK::Trace::SpanData>] span_data the # list of recorded {OpenTelemetry::SDK::Trace::SpanData} structs to be # exported. + # @param [optional Numeric] timeout An optional timeout in seconds. # @return [Integer] the result of the export. - def export(span_data) + def export(span_data, timeout: nil) return FAILURE if @shutdown + start_time = Time.now encoded_batches(span_data) do |batch| - return FAILURE if @shutdown + return FAILURE if @shutdown || OpenTelemetry::Common::Utilities.maybe_timeout(timeout, start_time)&.zero? @client.emitBatch(batch) end end # Called when {OpenTelemetry::SDK::Trace::Tracer#shutdown} is called, if # this exporter is registered to a {OpenTelemetry::SDK::Trace::Tracer} # object. - def shutdown + # + # @param [optional Numeric] timeout An optional timeout in seconds. + def shutdown(timeout: nil) @shutdown = true end private