respan-instrumentation-pgvector
Respan instrumentation for pgvector applications using psycopg 3. It traces
sync and async pgvector type registration, connection/cursor execution,
executemany, and result fetching as canonical Respan task spans. Psycopg 2 type
registration is also detected when the optional psycopg2 extra is installed.
Install
pip install respan-ai respan-instrumentation-pgvector pgvector "psycopg[binary]"
For pgvector's psycopg 2 adapter:
pip install "respan-instrumentation-pgvector[psycopg2]"
Quickstart
import os
import psycopg
import pgvector.psycopg as pgvector_psycopg
from respan import Respan, workflow
from respan_instrumentation_pgvector import PGVectorInstrumentor
respan = Respan(instrumentations=[PGVectorInstrumentor()])
dsn = os.environ["PGVECTOR_DSN"]
@workflow(name="pgvector_similarity_query_workflow")
def run_query(query_vector: list[float], limit: int):
with psycopg.connect(dsn) as connection:
pgvector_psycopg.register_vector(connection)
with connection.cursor() as cursor:
cursor.execute(
"SELECT id, embedding FROM items ORDER BY embedding <-> %s LIMIT %s",
(query_vector, limit),
)
return cursor.fetchall()
try:
print(run_query([0.1, 0.2, 0.3], 3))
finally:
try:
respan.flush()
finally:
respan.shutdown()
Pass capture_content=False to omit SQL arguments, parameters, and returned
rows while retaining operation names, status, and PostgreSQL attributes.
Activation/deactivation and instrument() / uninstrument() are idempotent.
All concurrently active instrumentors must use the same capture_content
setting; a conflicting activation is rejected instead of silently using the
first instance's setting.
SQLAlchemy applications that use the psycopg 3 driver are covered at the
underlying connection/cursor layer.
Captured values are valid JSON and capped at 16,000 UTF-8 bytes. Collections
and vectors include at most 128 preview items plus their count/truncation
metadata. Connection and other unsupported SDK objects are represented by a
stable type name rather than arbitrary repr() output; DSNs, credentials,
secrets, and process-specific memory addresses are redacted. Operation identity
is retained in traceloop.entity.name and standard database attributes. The
default semantic exporter displays these auto-emitted operation nodes as the
contract-defined bare task span name.
See respan-example-projects/python/tracing/pgvector for setup, distance
operators, sync/async, mutation, bulk insert, and deterministic error examples.
Metadata
Release files for respan-instrumentation-pgvector 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| respan_instrumentation_pgvector-0.1.1.tar.gz | 10.7 kB | Without provenance | Details for respan_instrumentation_pgvector-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| respan_instrumentation_pgvector-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for respan_instrumentation_pgvector-0.1.1-py3-none-any.whl |
Total release size: 21.8 kB
Release files / respan_instrumentation_pgvector-0.1.1.tar.gz
| Download URL | respan_instrumentation_pgvector-0.1.1.tar.gz |
|---|---|
| Size | 10.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
46bedb40feff2fd94a405055770a02289d890cf525a24dbb2927e633fee9adac
|
|
BLAKE2b-256 checksum How to use checksums |
0e9e99b0ad02a5a60e612bf5286a5074d1ca4a7dd68c3bce58e3a054d50b0d21
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / respan_instrumentation_pgvector-0.1.1-py3-none-any.whl
| Download URL | respan_instrumentation_pgvector-0.1.1-py3-none-any.whl |
|---|---|
| Size | 11.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5e6e2f237e5a9bb08b8bbaf3798309b98eb2a89920f1dba8f758d7433ed386ef
|
|
BLAKE2b-256 checksum How to use checksums |
9559942b713f0555fc84f51230775ef4d283bc8dd7e60cff346b341e7a848b61
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Security for respan-instrumentation-pgvector 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.