fix(qdrant): skip missing client methods#4349
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe Qdrant instrumentor now uses ChangesStatic Attribute Detection Fix
Estimated code review effort: 2 (Simple) | ~10 minutes Related issues: Suggested labels: bug, qdrant, instrumentation Suggested reviewers: nirga, galkleinman 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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.
🧹 Nitpick comments (1)
packages/opentelemetry-instrumentation-qdrant/tests/test_missing_methods.py (1)
1-53: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueSolid regression coverage for the metaclass edge case.
The metaclass
__getattr__trick correctly reproduces the scenario wherehasattrwould returnTruefor a removed method whilegetattr_staticcorrectly reports it absent, and the instrumentor test verifies wrapping is skipped accordingly. Consider adding a mirrored assertion (or a small follow-up test) for_uninstrumentto cover the symmetric code path, though it shares the same helper already validated here.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/opentelemetry-instrumentation-qdrant/tests/test_missing_methods.py` around lines 1 - 53, The new regression test covers _instrument on the metaclass edge case, but the symmetric _uninstrument path is still unverified. Add a small companion test near test_instrumentor_skips_methods_missing_from_client_class that uses the same _FakeQdrantClient, _FakeAsyncQdrantClient, and monkeypatch setup to assert QdrantInstrumentor()._uninstrument also skips upload_records while handling upload_points correctly, so both instrument and uninstrument use the same static-attribute check behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/opentelemetry-instrumentation-qdrant/tests/test_missing_methods.py`:
- Around line 1-53: The new regression test covers _instrument on the metaclass
edge case, but the symmetric _uninstrument path is still unverified. Add a small
companion test near test_instrumentor_skips_methods_missing_from_client_class
that uses the same _FakeQdrantClient, _FakeAsyncQdrantClient, and monkeypatch
setup to assert QdrantInstrumentor()._uninstrument also skips upload_records
while handling upload_points correctly, so both instrument and uninstrument use
the same static-attribute check behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: ed67e460-f22c-4e8f-ae89-b64a1f87c4c0
📒 Files selected for processing (2)
packages/opentelemetry-instrumentation-qdrant/opentelemetry/instrumentation/qdrant/__init__.pypackages/opentelemetry-instrumentation-qdrant/tests/test_missing_methods.py
|
Added companion coverage for the static-attribute check in the Verification run locally from
|
What Problem This Solves
versions that no longer expose were still being instrumented, which can raise an during .
Why This Change Was Made
The instrumentor now uses a static attribute lookup before wrapping methods, so dynamic class lookup cannot falsely report removed methods as present. I also added a regression test with a fake Qdrant client that only exposes through metaclass lookup.
User Impact
Users on newer releases can instrument Qdrant without the startup crash. Existing spans for supported methods still work.
Evidence
platform linux -- Python 3.10.19, pytest-8.4.2, pluggy-1.6.0
rootdir: /tmp/openllmetry-3492/packages/opentelemetry-instrumentation-qdrant
configfile: pyproject.toml
plugins: anyio-4.12.1, sugar-1.0.0
collected 6 items
tests/test_missing_methods.py .. [ 33%]
tests/test_qdrant_instrumentation.py .... [100%]
============================== 6 passed in 0.05s ===============================\n-
All checks passed!\n\nFixes #3492
Summary by CodeRabbit
Summary by CodeRabbit