From a716c607cb9f13410add6588adfc14d505ce897f Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Mon, 14 Oct 2024 17:13:02 +0400 Subject: [PATCH] Fix _otel lint Technically, `span.otel_span` can be None, which is not accepted by `trace.use_span`. --- elasticsearch_serverless/_otel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elasticsearch_serverless/_otel.py b/elasticsearch_serverless/_otel.py index 9d0863b..f76ca7e 100644 --- a/elasticsearch_serverless/_otel.py +++ b/elasticsearch_serverless/_otel.py @@ -106,7 +106,7 @@ def helpers_span(self, span_name: str) -> Generator[OpenTelemetrySpan, None, Non @contextlib.contextmanager def use_span(self, span: OpenTelemetrySpan) -> Generator[None, None, None]: - if not self.enabled or self.tracer is None: + if not self.enabled or self.tracer is None or span.otel_span is None: yield return