lib/opentelemetry/exporter/otlp/exporter.rb in opentelemetry-exporter-otlp-0.15.0 vs lib/opentelemetry/exporter/otlp/exporter.rb in opentelemetry-exporter-otlp-0.16.0
- old
+ new
@@ -74,18 +74,28 @@
return FAILURE if @shutdown
send_bytes(encode(span_data), timeout: timeout)
end
- # Called when {OpenTelemetry::SDK::Trace::Tracer#shutdown} is called, if
- # this exporter is registered to a {OpenTelemetry::SDK::Trace::Tracer}
+ # Called when {OpenTelemetry::SDK::Trace::TracerProvider#force_flush} is called, if
+ # this exporter is registered to a {OpenTelemetry::SDK::Trace::TracerProvider}
# object.
#
# @param [optional Numeric] timeout An optional timeout in seconds.
+ def force_flush(timeout: nil)
+ SUCCESS
+ end
+
+ # Called when {OpenTelemetry::SDK::Trace::TracerProvider#shutdown} is called, if
+ # this exporter is registered to a {OpenTelemetry::SDK::Trace::TracerProvider}
+ # object.
+ #
+ # @param [optional Numeric] timeout An optional timeout in seconds.
def shutdown(timeout: nil)
@shutdown = true
@http.finish if @http.started?
+ SUCCESS
end
private
def config_opt(*env_vars, default: nil)
@@ -174,9 +184,12 @@
@http.finish
FAILURE
end
rescue Net::OpenTimeout, Net::ReadTimeout
retry if backoff?(retry_count: retry_count += 1, reason: 'timeout')
+ return FAILURE
+ rescue SocketError
+ retry if backoff?(retry_count: retry_count += 1, reason: 'socket_error')
return FAILURE
end
ensure
# Reset timeouts to defaults for the next call.
@http.open_timeout = @timeout