Skip to Content

PostgreSQL

Capture PostgreSQL operations made through the pg driver.

ServerDevTools enables @opentelemetry/instrumentation-pg. Install pg, initialize the SDK first, and import the database client only after preload.

npm install server-devtools pg
const result = await pool.query("select id, email from users where id = $1", [id]);

The query span is linked to the active HTTP request and includes duration and error status. If no span appears, verify that the app starts with --import ./server-devtools.ts and that the query runs after the request enters the instrumented server.

ServerDevTools supports the pg driver. It does not document Prisma as a separately supported integration.
Last updated on