Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with 3.11.5 mysql2 span not being generated #2590

Open
liustve opened this issue Dec 6, 2024 · 8 comments
Open

Issue with 3.11.5 mysql2 span not being generated #2590

liustve opened this issue Dec 6, 2024 · 8 comments
Assignees
Labels
bug Something isn't working needs:reproducer This bug/feature is in need of a minimal reproducer pkg:instrumentation-mysql2 pkg-status:unmaintained This package is unmaintained. Only bugfixes may be acceped until a new owner has been found. priority:p2 Bugs and spec inconsistencies which cause telemetry to be incomplete or incorrect

Comments

@liustve
Copy link

liustve commented Dec 6, 2024

What version of OpenTelemetry are you using?

0.54.0 (latest)

What version of Node are you using?

v22.10.0

What did you do?

Set up an express server to make a call to a dummy nonexistant database using mysql2:
import mysql from 'mysql2';

const connection = mysql.createConnection({
host: process.env.DB_HOST,
user: process.env.DB_USER,
password: process.env.DB_PASSWORD
});

connection.query(
'CREATE DATABASE IF NOT EXISTS db',
(err, results) => {
if (err) {
console.error('Error creating database:', err);
return;
}
console.log('Database created successfully');
}
);

Ran using version 3.11.4, db span exists and gets populated:
image

Ran using version 3.11.5, no db span:
image

What did you expect to see?

DB span to populate in newest mysql2 version

What did you see instead?

No span running on the latest mysql2 version and latest otel js version.

Additional context

Related issue: aws-observability/aws-otel-js-instrumentation#127

@liustve liustve added the bug Something isn't working label Dec 6, 2024
@pichlermarc
Copy link
Member

pichlermarc commented Dec 6, 2024

huh, weird - I thought this was fixed in #2579

@pichlermarc
Copy link
Member

@liustve thanks for reaching out - assigning P2 (incomplete or missing telemetry).

@pichlermarc pichlermarc added pkg:instrumentation-mysql2 priority:p2 Bugs and spec inconsistencies which cause telemetry to be incomplete or incorrect pkg-status:unmaintained This package is unmaintained. Only bugfixes may be acceped until a new owner has been found. labels Dec 6, 2024
@david-luna
Copy link
Contributor

Hi @liustve

I've tried to reproduce the issue with no luck in this small project. For both versions of mysql2 (3.11.4 & 3.11.5) the instrumentation gets the db statement.

When you mention the version 0.54.0 (latest) which package are you referring to? I?m asking because there are several packages involved in the tracing setup.

this is the list of dependencies of the project

npm ls
[email protected] /Users/david/Documents/repos/dl/otel-js-contrib-2590
├── @opentelemetry/[email protected]
├── @opentelemetry/[email protected]
├── @opentelemetry/[email protected]
├── @opentelemetry/[email protected]
├── @opentelemetry/[email protected]
├── @opentelemetry/[email protected]
├── @opentelemetry/[email protected]
├── @types/[email protected]
├── [email protected]
├── [email protected]
└── [email protected]

could yo give me some directions on hot to reproduce the issue?

@david-luna david-luna added the needs:reproducer This bug/feature is in need of a minimal reproducer label Dec 13, 2024
@liustve
Copy link
Author

liustve commented Dec 13, 2024

Hi David, the package that I was using for this issue is v0.54.0:
https://www.npmjs.com/package/@opentelemetry/auto-instrumentations-node

The instrumentation I was using for mysql2 matches your version (0.44.0).
Would it be possible to set up a time to do a live debugging sometime next week?

Thanks!

@alexa-gt
Copy link

alexa-gt commented Jan 9, 2025

Can reproduce. Downgrading mysql2 fixed it for me.

Edit: [email protected] works for me.

@david-luna
Copy link
Contributor

@liustve @alexa-gt I've updated the small project mentioned in #2590 (comment) to use auto instrumentations and the CLI option to register it. I'm still seeing the span being sent to the collector. Could you provide a more complete example to reproduce the error? Is that call to a nonexistant DB inside an express middleware perhaps?

@alexa-gt
Copy link

Nope, it exists and is in an express handler. As attached with latest mysql2 version.

As requested, otel_poc.zip

@david-luna Can I see your package.json and package-lock.json?

@macno
Copy link
Contributor

macno commented Jan 16, 2025

huh, weird - I thought this was fixed in #2579

Hi @pichlermarc your fix seems to work only importing from mysql2 "directly" but not if you are importing from mysql2/promise

@david-luna that's why you don't replicate in your project

To reproduce you can use https://github.com/macno/otel-js-contrib-2590

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs:reproducer This bug/feature is in need of a minimal reproducer pkg:instrumentation-mysql2 pkg-status:unmaintained This package is unmaintained. Only bugfixes may be acceped until a new owner has been found. priority:p2 Bugs and spec inconsistencies which cause telemetry to be incomplete or incorrect
Projects
None yet
Development

No branches or pull requests

5 participants