fix(qdrant): cover `AsyncQdrantClient.query_points` and `query_batch_points`
Summary
Follow-up to #3492 / #3500 picking up the async-parity gap @kngyeol flagged in the issue thread.
The original crash from upload_records is gone since #3500, but the query_points / query_batch_points mismatch between the sync and async method configs is still present on main. Both methods exist on AsyncQdrantClient in current qdrant-client releases, the sync JSON already lists them, the async JSON does not, so async users get no spans for the modern query APIs.
Changes
async_qdrant_client_methods.json: addAsyncQdrantClient.query_pointsandAsyncQdrantClient.query_batch_pointsnext to the existingquery/query_batchentries, mirroring the sync layout.tests/test_qdrant_instrumentation.py: add two async tests that drivequery_pointsandquery_batch_pointsthrough the in-memoryAsyncQdrantClient, run viaasyncio.run(no new test deps), and assert the spans show up with the expected attributes. Usedupsertfor setup sinceAsyncQdrantClient.upload_collectionis sync internally and returnsNone.
Test plan
- [x]
uv run pytest tests/reports6 passed(4 existing sync tests + 2 new async ones). - [x]
uv run ruff check .reportsAll checks passed!. - [x] Verified locally that both methods exist on
AsyncQdrantClientin currentqdrant-clientso the wrap will not skip them at instrumentation time.
Refs #3492.
Summary by CodeRabbit
-
New Features
- Added OpenTelemetry spans for two asynchronous Qdrant query operations: qdrant.query_points and qdrant.query_batch_points, providing clearer tracing and query-specific attributes.
-
Tests
- Added tests that run async queries and verify emitted span names and key attributes (collection, top-k, batch count) to ensure telemetry correctness.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: e689b993-970e-44b0-971c-6f50bea7187e
📥 Commits
Reviewing files that changed from the base of the PR and between ef41cfc098279f23c63a74a5b6d3085dfdc29e2d and ace73d43b498491ec7b1758eaf2e5ad92b701181.
📒 Files selected for processing (2)
packages/opentelemetry-instrumentation-qdrant/opentelemetry/instrumentation/qdrant/async_qdrant_client_methods.jsonpackages/opentelemetry-instrumentation-qdrant/tests/test_qdrant_instrumentation.py
🚧 Files skipped from review as they are similar to previous changes (2)
- packages/opentelemetry-instrumentation-qdrant/opentelemetry/instrumentation/qdrant/async_qdrant_client_methods.json
- packages/opentelemetry-instrumentation-qdrant/tests/test_qdrant_instrumentation.py
📝 Walkthrough
Walkthrough
The PR adds JSON span mappings for AsyncQdrantClient.query_points and query_batch_points, and introduces async tests that run those methods via AsyncQdrantClient and assert the emitted span names and attributes.
Changes
Qdrant async query span coverage
| Layer / File(s) | Summary |
|---|---|
Span mapping configuration packages/opentelemetry-instrumentation-qdrant/.../async_qdrant_client_methods.json |
JSON configuration maps AsyncQdrantClient.query_points and query_batch_points to span names qdrant.query_points and qdrant.query_batch_points. |
Async test setup and validation packages/opentelemetry-instrumentation-qdrant/tests/test_qdrant_instrumentation.py |
Tests import asyncio and AsyncQdrantClient, add an async helper to create a collection and upsert points, and validate that query_points and query_batch_points emit the correct span names and expected attributes (collection name, top-k, batch request count). |
Sequence Diagram(s)
sequenceDiagram
participant Test as Test case
participant AsyncClient as AsyncQdrantClient
participant Instrumentation as OpenTelemetryInstrumentation
participant Exporter as InMemoryExporter
Test->>AsyncClient: call query_points / query_batch_points
AsyncClient->>Instrumentation: instrumented call (span created)
Instrumentation->>Exporter: export span (qdrant.query_points / qdrant.query_batch_points)
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~20 minutes
Poem
A rabbit hops through traces bright,
Async calls made in moonlit night,
Spans now bloom for queries run,
Points and batches seen as one,
🐰✨
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | ⚠️ Warning | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
✅ Passed checks (4 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title clearly summarizes the main change: adding async span coverage for two specific AsyncQdrantClient query methods that were previously missing from instrumentation. |
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing Touches
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
Thanks @coderabbitai :), fair callout. The clear_exporter autouse fixture in conftest.py already wipes the in-memory exporter between tests, so the failure mode you're describing does not actually trigger with the current setup, but you're right that the explicit clear inside each async test makes the contract obvious from the test body alone and survives any future fixture change.
Pushed in ef41cfc:
exporter.clear()at the top of bothtest_qdrant_async_query_pointsandtest_qdrant_async_query_batch_points, right before theasyncio.run(...)block, so thenext(span for span ...)lookup only sees spans produced by this test.
Re-ran locally, still 6/6 passing. Appreciate the second pair of eyes :)
[!TIP] For best results, initiate chat on the files or code changes.
@NishchayMahor: Great explanation — the belt-and-suspenders approach (conftest.py fixture + explicit exporter.clear()) is exactly the right call. The test intent is now self-documenting regardless of fixture ordering, and it's robust against future test infrastructure changes. Thanks for the clean follow-up! 🎉
(ノ◕ヮ◕)ノ*:・゚✧ 🐇
If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!