-
Notifications
You must be signed in to change notification settings - Fork 586
Open
Labels
bugSomething isn't workingSomething isn't workingpkg:instrumentation-mysql2priority:p2Bugs and spec inconsistencies which cause telemetry to be incomplete or incorrectBugs and spec inconsistencies which cause telemetry to be incomplete or incorrect
Description
What version of OpenTelemetry are you using?
@opentelemetry/auto-instrumentations-node
: v0.60.1@opentelemetry/instrumentation-mysql2
: v0.48.0 (pulled in by the auto-instrumentations bundle)
What version of Node are you using?
- Node.js v20
What did you do?
I have a Node.js/Express app using the mysql2/promise
API. I installed the auto-instrumentations bundle (which includes the MySQL2 instrumentation). In my code I run:
import { getNodeAutoInstrumentations } from "@opentelemetry/auto-instrumentations-node";
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http/build/src/platform/node/OTLPTraceExporter";
import { NodeSDK } from "@opentelemetry/sdk-node";
import { ATTR_SERVICE_NAME } from "@opentelemetry/semantic-conventions";
import { resourceFromAttributes } from "@opentelemetry/resources";
export function OpenTelemetryService() {
const env = process.env.NODE_ENV || "development";
const traceExporter = new OTLPTraceExporter({
url: "<redacted>/v1/traces",
});
const opentelemetry = new NodeSDK({
resource: resourceFromAttributes({
[ATTR_SERVICE_NAME]: `"<redacted>-${env}`,
}),
traceExporter,
instrumentations: [getNodeAutoInstrumentations()],
});
return opentelemetry;
}
const [rows] = await connection.promise().query('SELECT * FROM users');
What did you expect to see?
- A span named
mysql2.query
or reflecting the actual SQL statement - Semantic attributes including:
db.system
="mysql"
db.statement
="SELECT * FROM users"
db.name
,db.user
, etc.
What did you see instead?
- No MySQL-specific span, or only a generic “client” span without
db.system
- In Grafana Tempo the span is misclassified (no MySQL icon) and lacks the expected semantic attributes
Additional context
mysql2
version: 3.14.1
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingpkg:instrumentation-mysql2priority:p2Bugs and spec inconsistencies which cause telemetry to be incomplete or incorrectBugs and spec inconsistencies which cause telemetry to be incomplete or incorrect