Skip to content

Conversation

@pantajoe
Copy link
Contributor

@pantajoe pantajoe commented Nov 4, 2025

Which problem is this PR solving?

MikroORM overrides the default postgres client in knex to a PostreSqlKnexDialect, so Knex.client.config.client is not a string, but an instance to that dialect class.

Therefore, for users of an ORM that does this with knex, the knex instrumentation triggers a bunch of Invalid attribute set for database.system.name warnings.

Short description of the changes

Use knex.Client.config.driverName instead of knex.Client.config.client to derive the DB system attribute: database.system.name (or the deprecated one database.system)

@pantajoe pantajoe requested a review from a team as a code owner November 4, 2025 12:15
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Nov 4, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: david-luna / name: David Luna (6599929)

@github-actions github-actions bot added pkg:instrumentation-knex pkg-status:unmaintained This package is unmaintained. Only bugfixes may be acceped until a new owner has been found. labels Nov 4, 2025
@raphael-theriault-swi
Copy link
Member

Could you add a test case that illustrates the issue being fixed, and to make sure there isn't a regression in the future ?

@github-actions
Copy link
Contributor

github-actions bot commented Nov 5, 2025

This package does not have an assigned component owner and is considered unmaintained. As such this package is in feature-freeze and this PR will be closed with 14 days unless a new owner or a sponsor (a member of @open-telemetry/javascript-approvers) for the feature is found. It is the responsibility of the author to find a sponsor for this feature.
Are you familiar with this package? Consider becoming a component owner.

for users who use a custom dialect themselves or via ORM (example MikroORM)
@pantajoe
Copy link
Contributor Author

pantajoe commented Nov 8, 2025

Could you add a test case that illustrates the issue being fixed, and to make sure there isn't a regression in the future ?

Done ✅

@david-luna
Copy link
Contributor

david-luna commented Nov 11, 2025

@pantajoe

I've started the workflows but I'm not sure if this change will be compatible with all the versions supported >=0.10.0 <4.

Update: unit tests pass but we only test with the version set in package.json. There is no other version tested

Run npm run test-all-versions:ci:affected

> opentelemetry-js-contrib@0.1.0 test-all-versions:ci:affected
> npm --loglevel=silent run list:affected | xargs -I {} -t npm run --if-present test-all-versions -w {}

@david-luna
Copy link
Contributor

david-luna commented Nov 11, 2025

Tested down to v1.0.0 locally with the changes in #3221 and no errors :)

Let's merge #3221 first so we see the tests results in CI.

@pantajoe
Copy link
Contributor Author

Nice, happy to hear that 👍🏽

@david-luna david-luna added has:sponsor This package or feature has a sponsor that has volunteered to review PRs and respond to questions and removed pkg-status:unmaintained:autoclose-scheduled labels Nov 12, 2025
@david-luna david-luna merged commit 86eef0d into open-telemetry:main Nov 12, 2025
23 checks passed
@otelbot
Copy link
Contributor

otelbot bot commented Nov 12, 2025

Thank you for your contribution @pantajoe! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

has:sponsor This package or feature has a sponsor that has volunteered to review PRs and respond to questions pkg:instrumentation-knex pkg-status:unmaintained This package is unmaintained. Only bugfixes may be acceped until a new owner has been found.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants