Skip to main content

Splunk OpenTelemetry Weaviate instrumentation

Project description

pypi

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

  1. Install dependencies:

    pip install weaviate-client>=4.0.0 opentelemetry-sdk opentelemetry-exporter-otlp-proto-grpc
  2. Start a local Weaviate instance:

    docker run -d -p 8080:8080 -p 50051:50051 cr.weaviate.io/semitechnologies/weaviate:latest
  3. Run the example:

    cd examples/manual
    python3 example_v4.py
  4. (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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

splunk_otel_instrumentation_weaviate-0.1.0.tar.gz (21.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file splunk_otel_instrumentation_weaviate-0.1.0.tar.gz.

File metadata

File hashes

Hashes for splunk_otel_instrumentation_weaviate-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ac12efd5a4024afdd0d0ae8d15fe951142c57f0615f5eef04a84cc00db14b6e2
MD5 903e0955d993d9b94de70fb49c1d7722
BLAKE2b-256 824b288aa701f64382ed8e38943c82a7027feb07bee9a911af83b9299007d87a

See more details on using hashes here.

File details

Details for the file splunk_otel_instrumentation_weaviate-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for splunk_otel_instrumentation_weaviate-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a2343b12fba96a2fae556f0bc104020c7ad3f266b6149a30359d91a2a68c6bb4
MD5 db0f82e97ac723c62876f10cbd9f8c94
BLAKE2b-256 c6d5e99919623d265349a960d026ec8790216c9fbe85f275ff886e2819c49a1b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page