From fd95d8af7f9e136ba9943b9e77f8682a9105da15 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 13:03:04 +0400 Subject: [PATCH] [Backport 8.15] Fix _otel lint (#2655) (cherry picked from commit ac64e9f0ebb31b08ad8b36c2fa374698dd4ac26f) Co-authored-by: Quentin Pradet --- elasticsearch/_otel.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elasticsearch/_otel.py b/elasticsearch/_otel.py index 49de9201c..264d8aa35 100644 --- a/elasticsearch/_otel.py +++ b/elasticsearch/_otel.py @@ -98,7 +98,7 @@ def helpers_span(self, span_name: str) -> Generator[OpenTelemetrySpan, None, Non otel_span.set_attribute("db.operation", span_name) # Without a request method, Elastic APM does not display the traces otel_span.set_attribute("http.request.method", "null") - yield otel_span + yield OpenTelemetrySpan(otel_span) @contextlib.contextmanager def use_span(self, span: OpenTelemetrySpan) -> Generator[None, None, None]: @@ -106,5 +106,5 @@ def use_span(self, span: OpenTelemetrySpan) -> Generator[None, None, None]: yield return - with trace.use_span(span): + with trace.use_span(span.otel_span): yield