Splunk OpenTelemetry Weaviate instrumentation
Project description
This library allows tracing requests made by the Weaviate Python client to a Weaviate vector database.
Installation
pip install splunk-otel-instrumentation-weaviate
Usage
When using the instrumentor, all Weaviate clients will automatically be instrumented.
from opentelemetry.instrumentation.weaviate import WeaviateInstrumentor
import weaviate
# Instrument Weaviate
WeaviateInstrumentor().instrument()
# This client will be automatically instrumented
client = weaviate.connect_to_local()
# Use the client as normal - all operations will be traced
collection = client.collections.get("MyCollection")
result = collection.query.fetch_objects(limit=10)
Configuration
Content Capture
By default, document content from similarity search operations is not captured in span events. To enable content capture, set the following environment variable:
export OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true
When enabled, similarity search operations will emit weaviate.document events containing:
db.weaviate.document.content - The document content/properties
db.weaviate.document.distance - Distance metric (if available)
db.weaviate.document.certainty - Certainty score (if available)
db.weaviate.document.score - Relevance score (if available)
db.weaviate.document.query - The search query (if available)
The document count is always captured in the db.weaviate.documents.count span attribute regardless of this setting.
Examples
The examples/manual/ directory contains a working example:
example_v4.py - Comprehensive example showing various Weaviate v4 operations with automatic tracing
Running the example
Install dependencies:
pip install weaviate-client>=4.0.0 opentelemetry-sdk opentelemetry-exporter-otlp-proto-grpc
Start a local Weaviate instance:
docker run -d -p 8080:8080 -p 50051:50051 cr.weaviate.io/semitechnologies/weaviate:latest
Run the example:
cd examples/manual python3 example_v4.py
(Optional) Configure OTLP endpoint:
export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317"
Supported Versions
This instrumentation supports Weaviate client versions 3.x and 4.x.
References
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file splunk_otel_instrumentation_weaviate-0.1.0.tar.gz.
File metadata
- Download URL: splunk_otel_instrumentation_weaviate-0.1.0.tar.gz
- Upload date:
- Size: 21.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.16.3 cpython/3.11.14 HTTPX/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac12efd5a4024afdd0d0ae8d15fe951142c57f0615f5eef04a84cc00db14b6e2
|
|
| MD5 |
903e0955d993d9b94de70fb49c1d7722
|
|
| BLAKE2b-256 |
824b288aa701f64382ed8e38943c82a7027feb07bee9a911af83b9299007d87a
|
File details
Details for the file splunk_otel_instrumentation_weaviate-0.1.0-py3-none-any.whl.
File metadata
- Download URL: splunk_otel_instrumentation_weaviate-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.16.3 cpython/3.11.14 HTTPX/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2343b12fba96a2fae556f0bc104020c7ad3f266b6149a30359d91a2a68c6bb4
|
|
| MD5 |
db0f82e97ac723c62876f10cbd9f8c94
|
|
| BLAKE2b-256 |
c6d5e99919623d265349a960d026ec8790216c9fbe85f275ff886e2819c49a1b
|