Registry / observability / opentelemetry-instrumentation-qdrant

opentelemetry-instrumentation-qdrant

JSON →
library0.62.3pypypi✓ verified 23d ago

This library provides automatic OpenTelemetry tracing for the Qdrant vector database client in Python. It's part of the broader OpenLLMetry project, aiming to simplify observability for LLM applications. The library captures Qdrant operations like vector search, upserts, and collection management as OpenTelemetry spans, enriching them with relevant attributes. It typically follows the rapid release cadence of the main OpenLLMetry repository, often with weekly or daily updates.

pip install opentelemetry-instrumentation-qdrant qdrant-client opentelemetry-sdk
INSTALL
IMPORT
SIG · OPENTELEMETRY-INST
O
opentelemetry-instrumentation-qdrant
observabilitypythonv0.62.3
Install
9.7s avg
Import
4368ms
Disk
138MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.62.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 4.870s · 137.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 9.7s · import 3.866s · 131MB
138MB installed
● package 138MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

QdrantInstrumentor
from opentelemetry.instrumentation.qdrant import QdrantInstrumentor

This quickstart demonstrates how to set up OpenTelemetry to automatically trace Qdrant client operations. It initializes a basic `TracerProvider` with a `ConsoleSpanExporter`, instruments the Qdrant client, performs a `recreate_collection`, `upsert`, and `search` operation using an in-memory Qdrant client, and then shuts down the tracer provider to ensure all spans are exported.

import os from opentelemetry import trace from opentelemetry.sdk.resources import Resource from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import ConsoleSpanExporter, SimpleSpanProcessor from opentelemetry.instrumentation.qdrant import QdrantInstrumentor from qdrant_client import QdrantClient, models # 1. Setup OpenTelemetry Tracer Provider and Exporter resource = Resource.create({"service.name": "qdrant-example-app"}) provider = TracerProvider(resource=resource) processor = SimpleSpanProcessor(ConsoleSpanExporter()) provider.add_span_processor(processor) trace.set_tracer_provider(provider) # 2. Instrument Qdrant (must be called before client initialization) QdrantInstrumentor().instrument() # 3. Use Qdrant Client (operations will be automatically traced) # Using an in-memory client for a self-contained example client = QdrantClient(":memory:") # Use ":memory:" for a local, ephemeral instance collection_name = "my_test_collection" vector_size = 4 print(f"Creating collection: {collection_name}") client.recreate_collection( collection_name=collection_name, vectors_config=models.VectorParams(size=vector_size, distance=models.Distance.COSINE), ) print("Upserting points...") client.upsert( collection_name=collection_name, wait=True, points=[ models.PointStruct(id=1, vector=[0.05, 0.61, 0.76, 0.74], payload={"city": "Berlin"}), models.PointStruct(id=2, vector=[0.19, 0.81, 0.75, 0.11], payload={"city": "London"}) ], ) print("Searching points...") search_result = client.search( collection_name=collection_name, query_vector=[0.2, 0.7, 0.9, 0.1], limit=1, ) print(f"Search result: {search_result}") # 4. Ensure traces are flushed (important for ConsoleSpanExporter and script termination) trace.get_tracer_provider().shutdown()
Debug
Known issues
breakingSemantic Conventions Updates: `opentelemetry-instrumentation-qdrant` is part of the `openllmetry` project, which frequently updates its instrumentation to conform to the latest OpenTelemetry Generative AI Semantic Conventions. This can lead to changes in span attribute names, types, or structure, requiring updates to trace processing and analysis systems when upgrading `opentelemetry-instrumentation-qdrant` across major semantic convention bumps (e.g., versions from `0.53.0` onwards, aligning with GenAI Semconv `0.5.0` or later).
fix
Review the OpenTelemetry Generative AI Semantic Conventions documentation (https://opentelemetry.io/docs/specs/semconv/ai/llm/) and update your trace analysis queries or dashboards accordingly when upgrading.
affects: >=0.53.0
gotchaQdrant Client Installation: This instrumentation package only provides the hooks; it does not install `qdrant-client` itself. Users must explicitly `pip install qdrant-client` in addition to `opentelemetry-instrumentation-qdrant` for the instrumentation to function correctly, as `qdrant-client` is a peer dependency.
fix
Always ensure you install `qdrant-client` alongside `opentelemetry-instrumentation-qdrant` (e.g., `pip install opentelemetry-instrumentation-qdrant qdrant-client`).
affects: All
gotchaInstrumentation Order: The `QdrantInstrumentor().instrument()` method must be called *before* any `qdrant_client.QdrantClient` instances are initialized or used. If the `QdrantClient` is created prior to instrumentation, its operations will not be traced.
fix
Ensure `QdrantInstrumentor().instrument()` is called early in your application's startup phase, before any code that initializes or interacts with the `qdrant-client` library.
affects: All
Upgrade
Version history
0.62.3latest on PyPI · released Aug 10, 2026
Audit
Dependencies
opentelemetry-apirequiredCore OpenTelemetry API for tracing.
opentelemetry-sdkrequiredCore OpenTelemetry SDK for trace provider and processors.
wraptrequiredUsed for function wrapping and instrumentation.
opentelemetry-semantic-conventionsrequiredProvides standard semantic conventions for span attributes.
opentelemetry-instrumentationrequiredBase package for OpenTelemetry instrumentations.
qdrant-clientoptionalThe Qdrant Python client library being instrumented. Users must install this explicitly.
Agent activity
76 hits · last 30 days
node
68
Bingbot
1
OpenAI (training)
1
Resources
opentelemetry-instrumentation-qdrant — pip install opentelemetry-instrumentation-qdrant · libregistry