Skip to content

Commit

Permalink
[Backport 8.15] Fix _otel lint (#2655)
Browse files Browse the repository at this point in the history
(cherry picked from commit ac64e9f)

Co-authored-by: Quentin Pradet <[email protected]>
  • Loading branch information
github-actions[bot] and pquentin authored Sep 10, 2024
1 parent 780ea82 commit fd95d8a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions elasticsearch/_otel.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ 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]:
if not self.enabled or self.tracer is None:
yield
return

with trace.use_span(span):
with trace.use_span(span.otel_span):
yield

0 comments on commit fd95d8a

Please sign in to comment.