Conversation
| while time.time() < end_time: | ||
| if not client.cluster.pending_tasks().get("tasks", ()): | ||
| break | ||
| time.sleep(0.1) |
There was a problem hiding this comment.
This is not really related, but this busy loop was adding a lot of noise in OTel mode.
| ) | ||
|
|
||
| argv = pytest_argv() + ["-m", "otel"] | ||
| argv = pytest_argv() + ["-m", "otel"] + session.posargs |
There was a problem hiding this comment.
Again, not really related, but allowed things like nox -rs test_otel-3.14 -- test_elasticsearch/test_server/test_otel.py::test_otel_ping -s
There was a problem hiding this comment.
Pull Request Overview
This PR adds OpenTelemetry (OTel) instrumentation to the ping() method in both sync and async Elasticsearch clients. Since ping() is manually implemented rather than auto-generated, it requires explicit instrumentation setup.
- Added
endpoint_idandpath_partsparameters to theperform_requestcall inping()methods to enable OTel tracing - Added a dedicated test to verify ping method generates correct OTel spans
- Fixed a missing sleep in the test utility's busy-wait loop
- Enhanced the nox test configuration to accept additional pytest arguments
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| elasticsearch/_sync/client/init.py | Added OTel instrumentation parameters (endpoint_id, path_parts) to the sync ping() method's perform_request call |
| elasticsearch/_async/client/init.py | Added OTel instrumentation parameters (endpoint_id, path_parts) to the async ping() method's perform_request call |
| test_elasticsearch/test_server/test_otel.py | Added test_otel_ping() to verify ping method creates correct OTel spans with proper naming |
| test_elasticsearch/utils.py | Added missing time.sleep(0.1) to prevent busy-waiting in wait_for_cluster_state_updates_to_finish() |
| noxfile.py | Added session.posargs to test_otel session to support passing additional pytest arguments |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
(cherry picked from commit 3668213)
(cherry picked from commit 3668213)
(cherry picked from commit 3668213)
No description provided.