instrumentation-knex
doesn't handle errors raised by better-sqlite3
#2297
Labels
bug
Something isn't working
pkg:instrumentation-knex
priority:p2
Bugs and spec inconsistencies which cause telemetry to be incomplete or incorrect
What version of OpenTelemetry are you using?
What version of Node are you using?
v18.18.2
What did you do?
Instrument any application that uses knex and better-sqlite3 and trigger any SQL error.
What did you expect to see?
A span or trace should be correctly created and emitted.
What did you see instead?
A
TypeError: Expected second argument to be a string
is thrown instead and the application probably stops. Either way not span gets created.Additional context
Looking at the stackstrace:
The problem seems to be between https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/plugins/node/opentelemetry-instrumentation-knex/src/utils.ts#L48 that creates a new instance of the underlying error and https://github.com/WiseLibs/better-sqlite3/blob/master/lib/sqlite-error.js#L9 which requires callers to provide 2 arguments. The 2nd argument (
code
) is not being passed by the knex instrumenter.The text was updated successfully, but these errors were encountered: