Judgment Labs Logo
Other

Psycopg Tracing

Trace Psycopg PostgreSQL spans with Judgment.

Psycopg tracing uses the standard OpenTelemetry Psycopg instrumentation and routes PostgreSQL spans through Judgment.

uv add judgeval psycopg opentelemetry-instrumentation-psycopg
pip install judgeval psycopg opentelemetry-instrumentation-psycopg
psycopg_tracing.py
import psycopg
from judgeval import Tracer
from opentelemetry.instrumentation.psycopg import PsycopgInstrumentor

Tracer.init(project_name="psycopg_app")
Tracer.registerOTELInstrumentation(PsycopgInstrumentor())

# Create connections normally after registration.
# with psycopg.connect("postgresql://user:password@localhost/db") as conn:
#     conn.execute("select 1")

On this page

No Headings