openllmetry icon indicating copy to clipboard operation
openllmetry copied to clipboard

🐛 Bug Report: `opentelemetry-instrumentation-qdrant` is incompatible with `qdrant-client` version `1.16.1`

Open vitalii-diachkov-sumup opened this issue 11 months ago • 13 comments

I have just upgraded qdrant-client to v1.16.1 and with opentelemetry-insturmentation-qdrant of v0.48.1 I am getting attribute error. Traceback:

chatbot      |   File "/usr/src/chatbot/app/libs/otel.py", line 144, in init_otel_instrumentation
chatbot      |     QdrantInstrumentor().instrument(tracer_provider=otel_provider)
chatbot      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
chatbot      |   File "/usr/src/chatbot/.venv/lib/python3.13/site-packages/opentelemetry/instrumentation/instrumentor.py", line 125, in instrument
chatbot      |     result = self._instrument(  # pylint: disable=assignment-from-no-return
chatbot      |         **kwargs
chatbot      |     )
chatbot      |   File "/usr/src/chatbot/.venv/lib/python3.13/site-packages/opentelemetry/instrumentation/qdrant/__init__.py", line 55, in _instrument
chatbot      |     wrap_function_wrapper(
chatbot      |     ~~~~~~~~~~~~~~~~~~~~~^
chatbot      |         MODULE,
chatbot      |         ^^^^^^^
chatbot      |         f"{wrap_object}.{wrap_method}",
chatbot      |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
chatbot      |         _wrap(tracer, wrapped_method),
chatbot      |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
chatbot      |     )
chatbot      |     ^
chatbot      |   File "/usr/src/chatbot/.venv/lib/python3.13/site-packages/wrapt/patches.py", line 114, in wrap_function_wrapper
chatbot      |     return wrap_object(module, name, FunctionWrapper, (wrapper,))
chatbot      |   File "/usr/src/chatbot/.venv/lib/python3.13/site-packages/wrapt/patches.py", line 60, in wrap_object
chatbot      |     (parent, attribute, original) = resolve_path(module, name)
chatbot      |                                     ~~~~~~~~~~~~^^^^^^^^^^^^^^
chatbot      |   File "/usr/src/chatbot/.venv/lib/python3.13/site-packages/wrapt/patches.py", line 52, in resolve_path
chatbot      |     original = lookup_attribute(parent, attribute)
chatbot      |   File "/usr/src/chatbot/.venv/lib/python3.13/site-packages/wrapt/patches.py", line 44, in lookup_attribute
chatbot      |     return getattr(parent, attribute)
chatbot      | AttributeError: type object 'QdrantClient' has no attribute 'upload_records'

Apparently, upload_records is no longer a method of QdrantClient, maybe some other methods are missing, I haven't checked that

vitalii-diachkov-sumup avatar Dec 04 '25 14:12 vitalii-diachkov-sumup

Same issue here. Here's some more context:

Describe your environment

OS: macOS Tahoe 26.1 Python version: Python 3.14.0 Package version: 0.49.1 (opentelemetry-instrumentation-qdrant)

What happened?

The QdrantInstrumentor from opentelemetry-instrumentation-qdrant==0.49.1 fails to instrument when used with qdrant-client==1.16.0 (latest version). The instrumentor attempts to wrap the upload_records method on QdrantClient, but this method no longer exists in the current version of qdrant-client, causing an AttributeError during instrumentation.

The error occurs because the instrumentor's configuration file (qdrant_client_methods.json) lists upload_records as a method to wrap, but QdrantClient only has upload_points and upload_collection methods in version 1.16.0.

Steps to Reproduce

  1. Install the latest versions:
pip install qdrant-client==1.16.0 opentelemetry-instrumentation-qdrant==0.49.1
  1. Run below Python script:
from opentelemetry.instrumentation.qdrant import QdrantInstrumentor

QdrantInstrumentor().instrument()

Expected Result

The QdrantInstrumentor().instrument() call should successfully instrument the Qdrant client without errors, wrapping only the methods that actually exist in the current version of qdrant-client.

The instrumentor should either:

  1. Only attempt to wrap methods that exist in the installed version of qdrant-client, or
  2. Gracefully skip methods that don't exist without failing

Actual Result

The instrumentation fails immediately with an AttributeError:

Traceback (most recent call last):
QdrantInstrumentor().instrument()
File ".venv/lib/python3.14/site-packages/opentelemetry/instrumentation/instrumentor.py", line 125, in instrument
result = self._instrument(
**kwargs
)
File ".venv/lib/python3.14/site-packages/opentelemetry/instrumentation/qdrant/init.py", line 55, in _instrument
wrap_function_wrapper(
MODULE,
f"{wrap_object}.{wrap_method}",
_wrap(tracer, wrapped_method),
)
File ".venv/lib/python3.14/site-packages/wrapt/patches.py", line 114, in wrap_function_wrapper
return wrap_object(module, name, FunctionWrapper, (wrapper,))
File ".venv/lib/python3.14/site-packages/wrapt/patches.py", line 60, in wrap_object
(parent, attribute, original) = resolve_path(module, name)
File ".venv/lib/python3.14/site-packages/wrapt/patches.py", line 52, in resolve_path
original = lookup_attribute(parent, attribute)
File ".venv/lib/python3.14/site-packages/wrapt/patches.py", line 44, in lookup_attribute
return getattr(parent, attribute)
AttributeError: type object 'QdrantClient' has no attribute 'upload_records'

Additional context

No response

Would you like to implement a fix?

None

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

LudovA avatar Dec 05 '25 09:12 LudovA

Submitted PR for this Issue https://github.com/traceloop/openllmetry/pull/3500 Once the PR merged issue should be fixed . @nirga @gyliu513 please help review the PR , Thanks!

elinacse avatar Dec 06 '25 06:12 elinacse

I’d like to work on this. I’ll add compatibility with qdrant-client 1.16.1 (replace/handle upload_records).

adityajadhav192005 avatar Dec 18 '25 12:12 adityajadhav192005

@adityajadhav192005 it's already fixed in the PR https://github.com/traceloop/openllmetry/pull/3500 which pending to be merged . @nirga Could you please help here merge this PR . Thanks !

elinacse avatar Dec 18 '25 16:12 elinacse

Raised a PR https://github.com/traceloop/openllmetry/pull/3525 to fix the incompatibility. Hey @nirga can you help to review? Thank you

yizhao1998 avatar Dec 23 '25 05:12 yizhao1998

can i work on it

shoaib-niazi avatar Dec 24 '25 12:12 shoaib-niazi

PR is merged , Issue should be fixed by Now . Thanks !

elinacse avatar Feb 26 '26 11:02 elinacse

@vitalii-diachkov-sumup please update here if the issue still persists . Thanks !

elinacse avatar Feb 26 '26 15:02 elinacse

Hi! I'd like to fix this bug. The issue is clear — upload_records was removed in qdrant-client v1.16.1, so the instrumentor should check if the method exists before attempting to wrap it (e.g., using hasattr). This would be a small, targeted patch to the qdrant instrumentor. I have Python experience and can submit a fix. Happy to take this on if it's still open!

Quantum0uasar avatar May 18 '26 22:05 Quantum0uasar

I checked the current main branch and #3500 seems to avoid the original crash by skipping methods that do not exist.

One possible remaining gap: QdrantClient now includes query_points and query_batch_points in the instrumentation config, but AsyncQdrantClient does not seem to include the async equivalents yet.

Would a small follow-up PR adding async query_points / query_batch_points coverage and tests be useful?

kngyeol avatar May 26 '26 12:05 kngyeol

Nice catch on the async parity @kngyeol :), confirmed the same gap on current main: the sync JSON wraps query_points / query_batch_points but the async config only has query / query_batch, so async users get no spans for those calls even though AsyncQdrantClient exposes both methods.

Opened #4202 with the missing entries plus two async regression tests that drive each method through the in-memory client and assert the span shows up with the expected attributes. Used upsert for setup since AsyncQdrantClient.upload_collection is sync internally (returns None instead of an awaitable), one of those qdrant quirks worth noting somewhere.

The original upload_records crash this issue started with is already handled by #3500 plus the _instrument hasattr guard, so leaving that alone here. Happy to fold in any other sync-only methods if you spot more during review :)

NishchayMahor avatar May 30 '26 00:05 NishchayMahor

I can take a look at this. The fix should be straightforward — updating qdrant_client_methods.json to replace upload_records with the methods available in qdrant-client 1.16.x.

DresdenGman avatar Jul 09 '26 23:07 DresdenGman

The crash in this report no longer reproduces — the hasattr guard in QdrantInstrumentor._instrument() skips methods missing from the installed client, so upload_records no longer raises. But it turned a loud failure into silent span loss, and there's a real gap underneath it.

Auditing both wrapped-method lists against qdrant-client 1.19.0: 24 of 48 entries no longer resolve. The sync client is mostly covered because query_points and query_batch_points are listed. The async client is not — it has no query_points, query_points_groups or query_batch_points entry, while all ten of its listed search methods (search, search_batch, search_groups, query, query_batch, discover, discover_batch, recommend, recommend_batch, recommend_groups) were removed upstream in 1.12.

Net effect: AsyncQdrantClient emits zero search spans on any qdrant-client >= 1.12.

This went unnoticed because the test dependency group pins qdrant-client>=1.9.1,<1.12, so CI has never run against a client where those methods are absent.

Opened #4470 with the fix: add the modern query methods to both lists, lift the test pin, and add a coverage test so the lists can't silently drift again. Legacy entries are kept since the package declares support for qdrant-client >= 1.7.

Apologies for going straight to a PR rather than waiting to be assigned — happy to close it if you'd rather handle this differently, or if the async gap should be tracked as its own issue.

basil-k-aji-dev avatar Sep 13 '26 15:09 basil-k-aji-dev