Available for: Python and TypeScript.
recordRetrieval/record_retrieval helper. Zespan now patches Chroma’s Collection so every query(), add(), and upsert() call is captured automatically, the same way LLM provider calls already are.
Patched automatically as part of
zespan.autopatch(), which both SDKs run on init() unless you pass autopatch: false (autopatch=False in Python). There’s no separate opt-in call for vector-DB tracing.What gets traced
- Reads —
collection.query()emits aretrieverspan - Writes —
collection.add()andcollection.upsert()both emit anembeddingspan —add()is patched because it’s the more common ingestion call in RAG tutorials, not justupsert()
- Python
- TypeScript
Installation
Usage
Chroma’s
query() supports batching multiple queries in one call (query_texts=["q1", "q2"]). The wrapper only traces the first query’s results (index 0 of the returned per-query lists) — multi-query batching in a single call is uncommon enough in RAG apps that per-query span splitting is deferred until real usage shows it’s needed.Only the sync Chroma client (
chromadb.api.models.Collection) is auto-traced. The async client (AsyncHttpClient’s AsyncCollection) is not yet covered — if you’re on AsyncHttpClient, use the manual record_retrieval/record_vector_search helpers instead.What gets captured
Read span (query()) — span_kind: "retriever", operation: "vector_search"
content follows your storePrompts/store_prompts setting and the same redaction rules as prompt text — set storePrompts: false and document text is dropped while document_id/source/score are still kept.
Write span (add()/upsert()) — span_kind: "embedding", operation: "vector_upsert"
Next steps
- Manual spans — the
record_vector_search()/recordVectorSearch()helper for pgvector, and the fullwith_zespan_context()/withZespanContext()trace-linking pattern - Evaluating RAG pipelines — score retrieval quality once
rag_contextsis on the trace - Pinecone, Weaviate, Qdrant — the other auto-traced vector DBs

