lib/elastic/transport/transport/base.rb in elastic-transport-8.2.5 vs lib/elastic/transport/transport/base.rb in elastic-transport-8.3.0

- old
+ new

@@ -469,9 +469,17 @@ @request_options[:headers] else connection.connection.headers end end + + def capture_otel_span_attributes(connection, url) + if defined?(::OpenTelemetry) + ::OpenTelemetry::Trace.current_span&.set_attribute('url.full', url) + ::OpenTelemetry::Trace.current_span&.set_attribute('server.address', connection.host[:host]) + ::OpenTelemetry::Trace.current_span&.set_attribute('server.port', connection.host[:port].to_i) + end + end end end end end