Judgment Labs Logo
Other

Asyncpg

Trace Asyncpg PostgreSQL spans with Judgment.

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

uv add judgeval asyncpg opentelemetry-instrumentation-asyncpg
pip install judgeval asyncpg opentelemetry-instrumentation-asyncpg
asyncpg_tracing.py
import asyncpg
from judgeval import Tracer
from opentelemetry.instrumentation.asyncpg import AsyncPGInstrumentor

Tracer.init(project_name="asyncpg_app")
Tracer.registerOTELInstrumentation(AsyncPGInstrumentor())

# Create connections normally after registration.
# conn = await asyncpg.connect("postgresql://user:password@localhost/db")
# await conn.execute("select 1")

On this page

No Headings