-
Notifications
You must be signed in to change notification settings - Fork 619
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
What version of OpenTelemetry are you using?
ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-nodejs:0.67.2
instrumentation-pg as of 0.61.1 (grep version /otel-auto-instrumentation-nodejs/node_modules/@opentelemetry/instrumentation-pg/package.json)
What version of Node are you using?
v22.7.0
What did you do?
The original error is from postgres-migrations but if you use sql-template-strings as the examples show, this can be triggered
import { Client } from "pg";
import SQL from "sql-template-strings";
const client = new Client();
await client.connect();
const name = "any";
client
.query(
SQL`SELECT * FROM information_schema.tables WHERE table_name = ${name}`,
)
.then((result) => {
console.log(result.rowCount);
process.exit(0);
});What did you expect to see?
node index.js
0
What did you see instead?
/private/tmp/bug-report/autoinstrumentation/node_modules/@opentelemetry/instrumentation-pg/build/src/utils.js:80
const indexOfFirstSpace = queryText.indexOf(" ");
^
TypeError: Cannot read properties of undefined (reading 'indexOf')
at parseNormalizedOperationName (/private/tmp/bug-report/autoinstrumentation/node_modules/@opentelemetry/instrumentation-pg/build/src/utils.js:80:39)
at getQuerySpanName (/private/tmp/bug-report/autoinstrumentation/node_modules/@opentelemetry/instrumentation-pg/build/src/utils.js:73:9)
at Client.handleConfigQuery (/private/tmp/bug-report/autoinstrumentation/node_modules/@opentelemetry/instrumentation-pg/build/src/utils.js:209:20)
at Client.query (/private/tmp/bug-report/autoinstrumentation/node_modules/@opentelemetry/instrumentation-pg/build/src/instrumentation.js:288:46)
at file:///private/tmp/bug-report/index.js:9:4
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Additional context
Here are the types that it returns
ARGS ARE: [
SQLStatement {
strings: [
'SELECT * FROM information_schema.tables WHERE table_name = ',
''
],
values: [ 'any' ]
}
]
Query Config: {
strings: [ 'SELECT * FROM information_schema.tables WHERE table_name = ', '' ],
values: [ 'any' ]
}
package.json
{
"name": "bug-report",
"module": "index.js",
"type": "module",
"private": true,
"peerDependencies": {
"typescript": "^5"
},
"dependencies": {
"pg": "^8.16.3",
"sql-template-strings": "^2.2.2"
}
}
the auto instrumentation I copied from the docker container
Tip: React with π to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.
jaysonsantos, ranimufid and janv
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working