vd.health#
Health check and validation utilities for vd.
Provides functions to check backend health, validate configurations, and benchmark performance.
Functions
|
Benchmark document insertion performance. |
|
Benchmark search performance on a collection. |
|
Check if a backend is healthy and accessible. |
|
Check collection health and compute basic stats. |
- vd.health.benchmark_insert(collection, n_documents=100, *, text_length=100, batch_size=10)[source]#
Benchmark document insertion performance.
- Parameters:
collection (
Collection) – Collection to benchmarkn_documents (
int) – Number of documents to inserttext_length (
int) – Length of test documentsbatch_size (
int) – Batch size for insertion
- Returns:
Benchmark results
- Return type:
Examples
>>> import vd >>> client = vd.connect('memory') >>> docs = client.create_collection('test') >>> results = vd.benchmark_insert(docs, n_documents=50)
- vd.health.benchmark_search(collection, query, *, n_queries=100, limit=10)[source]#
Benchmark search performance on a collection.
- Parameters:
collection (
Collection) – Collection to benchmarkquery (
str) – Query text to usen_queries (
int) – Number of queries to runlimit (
int) – Number of results per query
- Returns:
Benchmark results with:
total_time: Total time for all queries
avg_latency: Average query latency
min_latency: Minimum latency
max_latency: Maximum latency
p50, p95, p99: Latency percentiles
queries_per_second: Throughput
- Return type:
Examples
>>> import vd >>> client = vd.connect('memory') >>> docs = client.create_collection('test') >>> # Add some documents... >>> results = vd.benchmark_search(docs, "test query", n_queries=50)
- vd.health.health_check_backend(backend_name, **config)[source]#
Check if a backend is healthy and accessible.
- Parameters:
backend_name (
str) – Backend name to check**config – Backend-specific configuration
- Returns:
Health report with keys:
status: ‘healthy’, ‘unhealthy’, or ‘unavailable’
available: Whether backend is installed
registered: Whether backend is registered
message: Status message
details: Additional details (if connected successfully)
- Return type:
Examples
>>> import vd >>> status = vd.health_check_backend('memory') >>> print(status['status']) 'healthy'
- vd.health.health_check_collection(collection)[source]#
Check collection health and compute basic stats.
- Parameters:
collection (
Collection) – Collection to check- Returns:
Health report
- Return type:
Examples
>>> import vd >>> client = vd.connect('memory') >>> docs = client.create_collection('test') >>> status = vd.health_check_collection(docs)