Skip to Content

MySQL

Capture MySQL operations made through mysql2.

The SDK enables @opentelemetry/instrumentation-mysql2. Install mysql2 and preload ServerDevTools before creating or importing the client.

npm install server-devtools mysql2
const [rows] = await pool.query("select id, email from users where id = ?", [id]);

Queries appear as child database operations under the request trace with timing and error information. Missing operations usually indicate that the driver loaded before the preload module or that the query ran outside an active request.

Last updated on