VectorDB observability setup
VectorDB Observability provides comprehensive monitoring for vector database performance, crucial for applications involving similarity searches, semantic search, and RAG (Retrieval-Augmented Generation) systems.
Install the instrumentation SDK
Install the OpenLIT SDK in your Python environment:
pip install openlit
Configure OTEL environment variables
Get your Grafana Cloud OTEL credentials
If you haven’t already obtained your OTEL credentials during the main AI Observability setup, follow these steps:
- Sign in to Grafana Cloud and go to the Grafana Cloud Portal
- Select your organization if you have access to multiple
- Click your stack from the sidebar or main stack list
- Under Manage your stack, click the Configure button in the OpenTelemetry section
- Scroll down to the Password / API Token section and click Generate now (if you don’t have a token)
- Enter a name for the token and click Create token
- Click Close - you don’t need to copy the token manually
- Scroll down and copy the
OTEL_EXPORTER_OTLP_ENDPOINT
andOTEL_EXPORTER_OTLP_HEADERS
values from the Environment variables section
Set the environment variables
Set up the OpenTelemetry endpoints using the values you copied:
export OTEL_EXPORTER_OTLP_ENDPOINT="<YOUR_GRAFANA_OTEL_GATEWAY_URL>"
export OTEL_EXPORTER_OTLP_HEADERS="<YOUR_GRAFANA_OTEL_GATEWAY_AUTH>"
Replace the values with those you copied:
- Replace
<YOUR_GRAFANA_OTEL_GATEWAY_URL>
with theOTEL_EXPORTER_OTLP_ENDPOINT
value
Example:https://otlp-gateway-<ZONE>.grafana.net/otlp
- Replace
<YOUR_GRAFANA_OTEL_GATEWAY_AUTH>
with theOTEL_EXPORTER_OTLP_HEADERS
value
Example:Authorization=Basic%20<BASE64 ENCODED INSTANCE ID AND API TOKEN>
Instrument your application
Add the following two lines to your application code:
import openlit
openlit.init()
The OpenLIT SDK automatically uses the OTEL environment variables to send telemetry data to your Grafana Cloud instance.
Examples by vector database
Pinecone
import openlit
import pinecone
openlit.init()
# Pinecone operations are automatically instrumented
pinecone.init(api_key="your-api-key", environment="your-env")
index = pinecone.Index("your-index")
# Vector operations are automatically tracked
results = index.query(
vector=[0.1, 0.2, 0.3],
top_k=10,
include_metadata=True
)
Chroma
import openlit
import chromadb
openlit.init()
# Chroma operations are automatically instrumented
client = chromadb.Client()
collection = client.create_collection("my_collection")
# Vector operations are automatically tracked
results = collection.query(
query_embeddings=[[0.1, 0.2, 0.3]],
n_results=10
)
Refer to the OpenLIT documentation for more vector database providers.
Visualize and analyze
With the VectorDB Observability data now being collected and sent to Grafana Cloud, the next step is to visualize and analyze this data to get insights into your vector database performance, behavior, and identify areas of improvement.
Navigate to the VectorDB Observability dashboard in your Grafana Cloud instance to start exploring. The dashboard provides:
- Query performance - Response times and throughput metrics
- Operation monitoring - Success rates and error tracking
- Database health - Connection status and availability
- Resource usage - Vector storage and computation metrics