From 9d69b502ef133890dd80e92ef46f8495c0463a9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Boschi?= Date: Tue, 12 Nov 2024 08:01:25 +0100 Subject: [PATCH] Fix import when trace is missing from opentelemetry (#2694) (cherry picked from commit de6ed823f1e6c0094ed3f94d78e9bab6fd5c124e) --- elasticsearch/_otel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elasticsearch/_otel.py b/elasticsearch/_otel.py index 264d8aa35..4bb57dae7 100644 --- a/elasticsearch/_otel.py +++ b/elasticsearch/_otel.py @@ -25,7 +25,7 @@ from opentelemetry import trace _tracer: trace.Tracer | None = trace.get_tracer("elasticsearch-api") -except ModuleNotFoundError: +except ImportError: _tracer = None from elastic_transport import OpenTelemetrySpan