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 psycopg
import pgvector.psycopg as pgvector_psycopg
from respan import Respan, workflow
from respan_instrumentation_pgvector import PGVectorInstrumentor
respan = Respan(instrumentations=[PGVectorInstrumentor()])
@workflow(name="pgvector_similarity_query_workflow")
def run_query(dsn: str):
with psycopg.connect(dsn) as connection:
pgvector_psycopg.register_vector(connection)
return connection.execute(
"SELECT id, embedding FROM items ORDER BY embedding <-> %s LIMIT 3",
([0.1, 0.2, 0.3],),
).fetchall()
print(run_query("postgresql://localhost/postgres"))
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.
SQLAlchemy applications that use the psycopg 3 driver are covered at the
underlying connection/cursor layer.
See respan-example-projects/python/tracing/pgvector for setup, distance
operators, sync/async, mutation, bulk insert, and deterministic error examples.
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 respan_instrumentation_pgvector-0.1.0.tar.gz.
File metadata
- Download URL: respan_instrumentation_pgvector-0.1.0.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/2.3.2 CPython/3.13.12 Linux/6.17.0-35-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28ecc5ffb78381cf702ddfa7223afe1a124932f5d097ddb2b4804a6d07c7dadd
|
|
| MD5 |
4257e5a52755f850bc453a5b0e66bbe3
|
|
| BLAKE2b-256 |
8f1af15c8119b0b9205cfc4a4596a330b6509986e4657d90d19161065968561c
|
File details
Details for the file respan_instrumentation_pgvector-0.1.0-py3-none-any.whl.
File metadata
- Download URL: respan_instrumentation_pgvector-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/2.3.2 CPython/3.13.12 Linux/6.17.0-35-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a44b64bda511650b163c806d16b84472ea04460aada8081a3f48c6a146a56e57
|
|
| MD5 |
a8d9a3162a42f51d7bcd3638c253ca8a
|
|
| BLAKE2b-256 |
341e21369b4f57802f587b0e2d043c18ae12465ae544f071c8087b9e671e4b26
|