Skip to content

MySQL integration for @sentry/node does not create any spans #8906

@mydea

Description

@mydea

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/node

SDK Version

7.65.0

Framework Version

No response

Link to Sentry event

No response

SDK Setup

const Sentry = require("@sentry/node");
const { ProfilingIntegration } = require("@sentry/profiling-node");

Sentry.init({
  dsn: process.env.SENTRY_DSN,
  debug: true,
  tracesSampleRate: 1,
  profilesSampleRate: 1,
  integrations: [
    ...Sentry.autoDiscoverNodePerformanceMonitoringIntegrations(),
    new ProfilingIntegration(),
  ]
});

Steps to Reproduce

An express route like this:

 app.get("/test-mysql",async  function (req, res) {
    const mysql = require('mysql');
    const connection =  mysql.createConnection({
      host: 'localhost',
      user: 'root',
      database: 'test-app',
      password: 'password'
    });

    const movies = [];
    for(let i = 1; i <= 15; i++) {
      const rows = await new Promise((resolve, reject) => {
        connection.query(
          'SELECT * FROM `movies` WHERE `title` = ?',
          [`Joker${i}`],
          function (error, results, fields) {
            if (error) {
              return reject(error);
            }

            resolve(results);
          }
        );
      });


      movies.push(...rows);
    }

    connection.end();

    res.send({ movies });
  });

Expected Result

Should get DB spans.

Actual Result

Does not generate any DB spans.

Sentry Logger [log]: [Tracing] starting http.server transaction - GET /test-mysql
Sentry Logger [log]: [Profiling] started profiling transaction: GET /test-mysql
Sentry Logger [log]: [Profiling] stopped profiling of transaction: GET /test-mysql
Sentry Logger [log]: [Tracing] Finishing http.server transaction: GET /test-mysql.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions