-
Notifications
You must be signed in to change notification settings - Fork 853
fix(qdrant): support 1.16+ of qdrant-client #3525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix(qdrant): support 1.16+ of qdrant-client #3525
Conversation
WalkthroughUpdated OpenTelemetry instrumentation for Qdrant client to support version 1.16+, introducing renamed query-centric methods (search → query_points, recommend → query_batch_points), removing deprecated methods, adding facet and matrix search capabilities, and updating all corresponding instrumentation wrappers and tests. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Important
Looks good to me! 👍
Reviewed everything up to eb89d20 in 59 seconds. Click for details.
- Reviewed
375lines of code in6files - Skipped
1files when reviewing. - Skipped posting
6draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. packages/opentelemetry-instrumentation-qdrant/opentelemetry/instrumentation/qdrant/__init__.py:23
- Draft comment:
Updated qdrant-client dependency from >=1.7 to >=1.16. Ensure this breaking change is intentional and that users are aware of the upgrade. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =0%<= threshold50%The comment is about a dependency change, specifically updating the qdrant-client dependency version. The comment asks the author to ensure the change is intentional and that users are aware, which violates the rule against asking the author to confirm intentions or ensure awareness. Therefore, this comment should be removed.
2. packages/opentelemetry-instrumentation-qdrant/opentelemetry/instrumentation/qdrant/async_qdrant_client_methods.json:8
- Draft comment:
Removed deprecated methods (e.g. upload_records, search, search_batch, search_groups, discover, recommend, etc.) and added new methods (query_points, query_batch_points, query_points_groups, scroll, retrieve, facet, search_matrix_offsets, search_matrix_pairs) to align with qdrant-client 1.16+ API. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
3. packages/opentelemetry-instrumentation-qdrant/opentelemetry/instrumentation/qdrant/qdrant_client_methods.json:8
- Draft comment:
Updated method mappings in QdrantClient JSON similarly to the async client. Deprecated methods are removed and replaced with new query methods. Verify that these mappings match the updated client API. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
4. packages/opentelemetry-instrumentation-qdrant/opentelemetry/instrumentation/qdrant/wrapper.py:50
- Draft comment:
Removed branch for 'upload_records' and updated conditionals to handle new query methods. Also, renamed helper functions from _set_search_attributes to _set_query_attributes and _set_batch_search_attributes to _set_batch_query_attributes to reflect API changes. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
5. packages/opentelemetry-instrumentation-qdrant/pyproject.toml:37
- Draft comment:
Updated the qdrant-client dependency version in test dependencies to ^1.16.1. Confirm that all tests and behavior are compatible with this newer version. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =0%<= threshold50%This comment is asking the PR author to confirm compatibility with a new dependency version, which violates the rule against asking for confirmation or ensuring behavior is intended. It also relates to dependency changes, which should not be commented on unless there's a specific issue identified.
6. packages/opentelemetry-instrumentation-qdrant/tests/test_qdrant_instrumentation.py:7
- Draft comment:
Fixed typo in fixture docstring ('in-memroy' to 'in-memory') and updated test cases to reflect new method names (query_points, query_batch_points) as well as updated attribute keys. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =0%<= threshold50%This comment is purely informative, describing what changes were made in the PR. It does not provide any suggestions, ask for confirmation, or highlight any potential issues. According to the rules, purely informative comments should be removed.
Workflow ID: wflow_RMNaM7zl5ezLoqTP
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/opentelemetry-instrumentation-qdrant/opentelemetry/instrumentation/qdrant/wrapper.py (1)
101-109: Consider prefixing unusedargswith underscore to silence linter.Static analysis flags
argsas unused in both_set_query_attributesand_set_batch_query_attributes. Ifargsis kept for API consistency or future use, prefix it with_to indicate intentional non-use.🔎 Proposed fix
@dont_throw -def _set_query_attributes(span, args, kwargs): +def _set_query_attributes(span, _args, kwargs): limit = kwargs.get("limit") or 10 _set_span_attribute(span, SpanAttributes.VECTOR_DB_QUERY_TOP_K, limit) @dont_throw -def _set_batch_query_attributes(span, args, kwargs, method): +def _set_batch_query_attributes(span, _args, kwargs, method): requests = kwargs.get("requests") or [] _set_span_attribute(span, f"qdrant.{method}.requests_count", len(requests))
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
packages/opentelemetry-instrumentation-qdrant/poetry.lockis excluded by!**/*.lock
📒 Files selected for processing (6)
packages/opentelemetry-instrumentation-qdrant/opentelemetry/instrumentation/qdrant/__init__.pypackages/opentelemetry-instrumentation-qdrant/opentelemetry/instrumentation/qdrant/async_qdrant_client_methods.jsonpackages/opentelemetry-instrumentation-qdrant/opentelemetry/instrumentation/qdrant/qdrant_client_methods.jsonpackages/opentelemetry-instrumentation-qdrant/opentelemetry/instrumentation/qdrant/wrapper.pypackages/opentelemetry-instrumentation-qdrant/pyproject.tomlpackages/opentelemetry-instrumentation-qdrant/tests/test_qdrant_instrumentation.py
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.py: Store API keys only in environment variables/secure vaults; never hardcode secrets in code
Use Flake8 for code linting and adhere to its rules
Files:
packages/opentelemetry-instrumentation-qdrant/opentelemetry/instrumentation/qdrant/__init__.pypackages/opentelemetry-instrumentation-qdrant/tests/test_qdrant_instrumentation.pypackages/opentelemetry-instrumentation-qdrant/opentelemetry/instrumentation/qdrant/wrapper.py
🧬 Code graph analysis (2)
packages/opentelemetry-instrumentation-qdrant/tests/test_qdrant_instrumentation.py (1)
packages/opentelemetry-semantic-conventions-ai/opentelemetry/semconv_ai/__init__.py (1)
SpanAttributes(64-245)
packages/opentelemetry-instrumentation-qdrant/opentelemetry/instrumentation/qdrant/wrapper.py (2)
packages/opentelemetry-instrumentation-chromadb/opentelemetry/instrumentation/chromadb/wrapper.py (2)
_set_query_attributes(154-180)_set_span_attribute(26-30)packages/opentelemetry-instrumentation-qdrant/opentelemetry/instrumentation/qdrant/utils.py (1)
dont_throw(6-28)
🪛 Ruff (0.14.10)
packages/opentelemetry-instrumentation-qdrant/opentelemetry/instrumentation/qdrant/wrapper.py
101-101: Unused function argument: args
(ARG001)
107-107: Unused function argument: args
(ARG001)
🔇 Additional comments (10)
packages/opentelemetry-instrumentation-qdrant/opentelemetry/instrumentation/qdrant/wrapper.py (1)
58-65: LGTM - Method dispatch updated for query-centric API.The updated dispatch logic correctly routes the new query-related methods (
query_points,query_points_groups,query_batch,query_batch_points) to the appropriate attribute-setting functions.packages/opentelemetry-instrumentation-qdrant/tests/test_qdrant_instrumentation.py (3)
43-44: Attribute key correctly updated to match dynamic naming pattern.The change from
SpanAttributes.QDRANT_UPSERT_COLLECTION_NAMEto the hardcoded string"qdrant.upsert.collection_name"is correct, as the wrapper dynamically generates collection name attributes usingf"qdrant.{method}.collection_name".
73-85: Tests properly updated for query_points API.The test correctly uses the new
query_pointsmethod with the renamedqueryparameter (previouslyvector) and validates the expected span attributes.
88-108: Tests properly updated for query_batch_points API.The test correctly uses
query_batch_pointswithmodels.QueryRequest(replacingSearchRequest) and validates the batch request count attribute.Consider adding test coverage for new methods.
The PR introduces several new instrumented methods (
facet,search_matrix_offsets,search_matrix_pairs,scroll,retrieve) in the JSON configs, but tests only coverquery_pointsandquery_batch_points. Consider adding basic tests for the new methods to ensure instrumentation works correctly.packages/opentelemetry-instrumentation-qdrant/opentelemetry/instrumentation/qdrant/qdrant_client_methods.json (2)
32-56: New query-centric methods added correctly.The method configurations for
query_points,query_batch_points,query_points_groups,scroll, andretrievefollow the established naming pattern and align with the qdrant-client 1.16+ API changes.
92-106: New facet and matrix search methods added.The additions of
facet,search_matrix_offsets, andsearch_matrix_pairsextend instrumentation coverage for facet counting and distance matrix calculation capabilities available in qdrant-client since version 1.12.Likely an incorrect or invalid review comment.
packages/opentelemetry-instrumentation-qdrant/opentelemetry/instrumentation/qdrant/__init__.py (1)
23-23: Breaking change: Minimum qdrant-client version raised from 1.7 to 1.16.This constraint update is necessary since the instrumentation wraps methods (
query_points,query_batch_points, etc.) that only exist in qdrant-client 1.16+. Users on older versions will need to upgrade or pin to an older instrumentation version.Consider adding a note to the changelog or release notes about this breaking change for users currently on qdrant-client versions 1.7-1.15.
packages/opentelemetry-instrumentation-qdrant/opentelemetry/instrumentation/qdrant/async_qdrant_client_methods.json (2)
32-56: Async methods correctly mirror sync client updates.The
AsyncQdrantClientmethod configurations are symmetric withQdrantClient, using consistentqdrant.{method}span names for both sync and async operations.
92-106: New async facet and matrix methods added.Consistent with the sync client, the async configurations for
facet,search_matrix_offsets, andsearch_matrix_pairscomplete the instrumentation coverage for the new qdrant-client 1.16+ capabilities.packages/opentelemetry-instrumentation-qdrant/pyproject.toml (1)
37-37: Verify that qdrant-client 1.16.1 is available on PyPI.Version 1.16.1 is available on PyPI (released November 25, 2025), and no security advisories were found for this release. The caret version constraint
^1.16.1allows versions from 1.16.1 through <2.0.0, which aligns with the runtime requirements.
feat(instrumentation): ...orfix(instrumentation): ....Important
Update Qdrant client support to 1.16+, modify instrumentation and tests for new client methods.
qdrant-clientdependency to^1.16.1inpyproject.toml._instrumentsin__init__.pyto requireqdrant-client >= 1.16.upload_records,search,search_batch,search_groups,discover,discover_batch,recommend,recommend_batch,recommend_groupsfromasync_qdrant_client_methods.jsonandqdrant_client_methods.json.query_points,query_batch_points,query_points_groups,scroll,retrieve,facet,search_matrix_offsets,search_matrix_pairsto both JSON files._wrap()inwrapper.pyto handle new methods and remove handling for removed methods.test_qdrant_instrumentation.pyto use new methodsquery_pointsandquery_batch_pointsinstead ofsearchandsearch_batch.test_qdrant_instrumentation.py.This description was created by
for eb89d20. You can customize this summary. It will automatically update as commits are pushed.
Summary by CodeRabbit
Release Notes
Refactor
Chores
✏️ Tip: You can customize this high-level summary in your review settings.