Skip to content

feat: Added support for knex #3172

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Conversation

jsumners-nr
Copy link
Contributor

This PR adds support for knex as the initial implementation of automatic OTEL bridge configuration.


registerInstrumentations({
instrumentations: [
new KnexInstrumentation({ maxQueryLength: -1, requireParentSpan: true })
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this instrumentation will conflict with our agent depending on the underlying db engine. I found during our initial POC that if you rely on db engines that we instrument you get duplicate segments. This needs to be solved before this is merged

removeModules(['knex', 'better-sqlite3'])
})

test('records queries', (t, end) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we're writing versioned tests they should align with other db libraries we instrument to ensure parity. you can check mysql, pg, etc for reference

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this has been addressed.

Copy link
Member

@bizob2828 bizob2828 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few comments

Copy link

codecov bot commented Jun 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.59%. Comparing base (3c915f5) to head (b4fd310).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3172      +/-   ##
==========================================
- Coverage   97.63%   97.59%   -0.05%     
==========================================
  Files         339      340       +1     
  Lines       51023    51049      +26     
==========================================
+ Hits        49818    49822       +4     
- Misses       1205     1227      +22     
Flag Coverage Δ
integration-tests-cjs-18.x 73.92% <88.88%> (+<0.01%) ⬆️
integration-tests-cjs-20.x 73.91% <88.88%> (+<0.01%) ⬆️
integration-tests-cjs-22.x 73.94% <88.88%> (+<0.01%) ⬆️
integration-tests-esm-18.x 49.65% <42.59%> (+<0.01%) ⬆️
integration-tests-esm-20.x 49.66% <42.59%> (+<0.01%) ⬆️
integration-tests-esm-22.x 49.72% <42.59%> (+<0.01%) ⬆️
unit-tests-18.x 88.34% <88.88%> (-0.01%) ⬇️
unit-tests-20.x 88.34% <88.88%> (-0.01%) ⬇️
unit-tests-22.x 88.35% <88.88%> (-0.01%) ⬇️
versioned-tests-18.x 79.99% <100.00%> (-0.16%) ⬇️
versioned-tests-20.x 80.11% <100.00%> (-0.16%) ⬇️
versioned-tests-22.x 80.12% <100.00%> (-0.16%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Needs PR Review
Development

Successfully merging this pull request may close these issues.

2 participants