in progress
Python sdk
two python clients ship with the project, pick the one that fits your workflow.
which sdk should i use?
| sdk | connects to | requires | use case |
|---|---|---|---|
| python_exporter | go exporter | exporter service running | prometheus-style monitoring |
qdrant_cloud_clientin progress | qdrant api directly | qdrant access | independent / cloud monitoring |
exporter sdk
this sdk reads the go exporter's
/metrics endpoint. run the go exporter first.install
bash
python -m pip install -r requirements.txt
python -m pip install -e .usage
example.py
from python_exporter import ExporterClient
client = ExporterClient("http://localhost:9999")
# list every metric name
print(client.metric_names())
# read a single value
print(client.get_value("qdrant_up"))
# read every sample for a labeled metric
print(client.get_samples("qdrant_collection_points"))
# pick a sample by label
print(client.get_value(
"qdrant_collection_points",
{"collection": "my_collection"},
))
# dump all metrics as json
print(client.to_json())what you get
- metric names pulled live from the exporter
- values for any metric the exporter exposes
- labeled collection data with no hardcoding
- automatic support for new metrics, the sdk stays in sync with go
live test
if the exporter is already running, run the integration suite:
bash
export EXPORTER_URL=http://localhost:9999
python -m pytest tests/test_live_exporter_sdk.py -m integrationor inspect a few collections without pytest:
bash
export EXPORTER_URL=http://localhost:9999
python tests/inspect_exporter.pyqdrant cloud sdkin progress
this one talks directly to the qdrant api. no go exporter required.
install
bash
python -m pip install -r requirements_cloud_sdk.txt
python -m pip install -e .usage
cloud_example.py
from qdrant_cloud_client import QdrantCloudClient
# local qdrant
client = QdrantCloudClient(base_url="http://localhost:6333")
# or qdrant cloud
client = QdrantCloudClient(
base_url="https://your-cluster.qdrant.io",
api_key="your-api-key",
)
# list collections
collections = client.get_collections()
# detailed info
info = client.get_collection_info("my_collection")
print(f"vectors: {info.vectors_count}")
# prometheus-style metrics
metrics = client.get_metrics()
for coll in metrics:
for name, value in coll.items():
print(f"{name} {value}")
# render as prometheus text
print(client.format_prometheus_metrics())what you get
- direct connection to qdrant cloud
- collection info without the go exporter
- same metric shape as the exporter
- local and cloud support
- api-key authentication
- prometheus-compatible text output
testing
bash
python -m pytest tests/test_qdrant_cloud_client.py -vneed a full example?
checkexamples/qdrant_cloud_usage.py in the repo, it covers health checks, error handling, and metric extraction.