Skip to main content

OpenTelemetry instrumentation for pgvector PostgreSQL extension

Project description

traceAI-pgvector

OpenTelemetry instrumentation for pgvector PostgreSQL extension.

Installation

pip install traceAI-pgvector

Quick Start

from fi_instrumentation import register
from traceai_pgvector import PgVectorInstrumentor
import psycopg2
from pgvector.psycopg2 import register_vector

trace_provider = register(project_name="my-rag-app")
PgVectorInstrumentor().instrument(tracer_provider=trace_provider)

conn = psycopg2.connect("postgresql://...")
register_vector(conn)

# All vector operations are traced
cur = conn.cursor()
cur.execute(
    "SELECT * FROM documents ORDER BY embedding <-> %s LIMIT 5",
    ([0.1, 0.2, ...],)
)

Instrumented Operations

The instrumentor captures PostgreSQL queries that contain pgvector operations:

  • <-> - L2 distance
  • <#> - Inner product distance
  • <=> - Cosine distance
  • <+> - L1 distance
Query Type Detection Captured Attributes
Vector similarity search ORDER BY ... <-> distance type, limit
Insert with vector INSERT INTO ... vector table name, vector count
Update with vector UPDATE ... SET vector table name

License

Apache License 2.0

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

traceai_pgvector-0.1.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

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

traceai_pgvector-0.1.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: traceai_pgvector-0.1.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for traceai_pgvector-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ca61ad9e3505e6bdc617b116977801aeea5d00d3672b6c3abf2b22c09dbfa8b8
MD5 6b4f41ac1f9da4760298ff685500358c
BLAKE2b-256 cc8b1aafc4d3d2f0e218fa33edf6ff15249a22ff9383fcfbfece3ef702385926

See more details on using hashes here.

File details

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

File metadata

  • Download URL: traceai_pgvector-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for traceai_pgvector-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a3574c99f66c3ea5ead5b74bddf5517298a0fd6bff0f803a057fd9a93b0cb337
MD5 91b2ad4c773b04a54eaadc651917914f
BLAKE2b-256 8beb5638b1c8b7b255dc1c028381f49fab72da407fe234a3f91c7efc91e7d44c

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