From 2879230d9d70cd39ab1540788c711e09bf23f6eb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 19:05:40 +0400 Subject: [PATCH] Fix import when trace is missing from opentelemetry (#2694) (#2704) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit de6ed823f1e6c0094ed3f94d78e9bab6fd5c124e) Co-authored-by: Nicolò Boschi --- 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