Skip to content

feat: typeorm instrumentation #2187

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

Merged
merged 90 commits into from
Apr 29, 2025

Conversation

seemk
Copy link
Contributor

@seemk seemk commented May 8, 2024

Short description of the changes

Adds the typeorm instrumentation created by Aspecto.

Only contains minor changes: upgraded to the latest SDK and semantic conventions package, modified the tests to use assert, changed the hook type signature.

@seemk seemk requested a review from a team May 8, 2024 14:02
Copy link

codecov bot commented May 8, 2024

Codecov Report

Attention: Patch coverage is 90.40404% with 19 lines in your changes missing coverage. Please review.

Project coverage is 89.55%. Comparing base (1e2db67) to head (71a25ab).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...lugins/node/instrumentation-typeorm/src/typeorm.ts 89.20% 19 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2187      +/-   ##
==========================================
+ Coverage   89.53%   89.55%   +0.01%     
==========================================
  Files         174      180       +6     
  Lines        8521     8719     +198     
  Branches     1727     1767      +40     
==========================================
+ Hits         7629     7808     +179     
- Misses        892      911      +19     
Files with missing lines Coverage Δ
...lugins/node/instrumentation-typeorm/src/semconv.ts 100.00% <100.00%> (ø)
plugins/node/instrumentation-typeorm/src/types.ts 100.00% <100.00%> (ø)
...entation-typeorm/src/utils/get-func-param-names.ts 100.00% <100.00%> (ø)
...ns/node/instrumentation-typeorm/src/utils/index.ts 100.00% <100.00%> (ø)
...strumentation-typeorm/src/utils/suppressTracing.ts 100.00% <100.00%> (ø)
...lugins/node/instrumentation-typeorm/src/typeorm.ts 89.20% <89.20%> (ø)
🚀 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.

Copy link
Member

@blumamir blumamir left a comment

Choose a reason for hiding this comment

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

Thank you for working on this 🙏🎉

Left few comments and suggestions

The original instrumentation had a test-all-versions setup. I wonder if it was left out on purpose or just overlooked.

import { InstrumentationConfig } from '@opentelemetry/instrumentation';

export enum ExtendedDatabaseAttribute {
DB_STATEMENT_PARAMETERS = 'db.statement.parameters',
Copy link
Member

Choose a reason for hiding this comment

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

While this isn't a speced name similar to many others, there is still this rule for semantic attributes which the existing name violates:

Names SHOULD NOT coincide with namespaces. For example if service.instance.id is an attribute name then it is no longer valid to have an attribute named service.instance because service.instance is already a namespace

Since we already have db.statement, I think it is better to use the opportunity and rename it to db.typeorm.parameters (similar to 'db.postgresql.values', 'db.mysql.values'). or some other good name that does not make db.statement a namespace.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed it, thanks

@seemk
Copy link
Contributor Author

seemk commented May 22, 2024

Thank you for working on this 🙏🎉

Left few comments and suggestions

The original instrumentation had a test-all-versions setup. I wonder if it was left out on purpose or just overlooked.

Overlooked, going to re-add it, thanks!

Copy link
Member

@blumamir blumamir left a comment

Choose a reason for hiding this comment

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

Thanks for addressing the comments. There are still few threads from previous review I think would be best to address now as this is already a breaking change from the original instrumentation and doing it later will be yet another breaking change for users.

If you prefer that we leave it as is, and address these less trivial cases sometime else, that is also ok with me.

@pichlermarc
Copy link
Member

cc @blumamir - I would appreciate you having another look if you find some time 🙂

@github-actions github-actions bot requested review from mhennoch and t2t2 April 25, 2025 08:05
@seemk
Copy link
Contributor Author

seemk commented Apr 25, 2025

@pichlermarc Added @t2t2 and @mhennoch as additional component owners, getting more people to help out with JS contrib, especially for the upcoming and/or ported instrumentations.

Copy link
Member

@pichlermarc pichlermarc left a comment

Choose a reason for hiding this comment

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

Looks good, thank you for working on this. 🙌

@t2t2 @mhennoch - thank you for joining as owners (I assume @seemk has reached out offline), please indicate that you're okay with this by approving the PR. 🙂

I'll leave this open for @blumamir to take a look until Monday - if there are no more comments by then I will merge this PR. 🙂

@pichlermarc
Copy link
Member

@seemk conflicts need to be resovled one last time then this is good to merge 🙂

@seemk
Copy link
Contributor Author

seemk commented Apr 29, 2025

@pichlermarc Thanks, there's one job that failed due to npm ERR! code ECONNRESET, can you trigger a rerun of this?

@seemk
Copy link
Contributor Author

seemk commented Apr 29, 2025

@pichlermarc Nvm, pushed an empty commit to trigger it

@pichlermarc pichlermarc merged commit f07dcce into open-telemetry:main Apr 29, 2025
25 checks passed
@dyladan dyladan mentioned this pull request Apr 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.