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