-
Notifications
You must be signed in to change notification settings - Fork 360
(feature): Prisma Output Support #7072
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
base: master
Are you sure you want to change the base?
Conversation
210a0a1 to
4965a67
Compare
Overall package sizeSelf size: 3.58 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 1.15.0 | 127.66 kB | 856.24 kB | | dc-polyfill | 0.1.10 | 26.73 kB | 26.73 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #7072 +/- ##
==========================================
- Coverage 84.82% 84.72% -0.11%
==========================================
Files 515 519 +4
Lines 22022 22161 +139
==========================================
+ Hits 18681 18775 +94
- Misses 3341 3386 +45 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
BenchmarksBenchmark execution time: 2025-12-12 14:40:44 Comparing candidate commit 985e014 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 291 metrics, 29 unstable metrics. |
9f1540b to
985e014
Compare
What does this PR do?
This PR intends to add support prisma client generated through the output field. the output field creates the prisma client in a custom path, which dd-trace has no context of, to add support a new env DD_PRISMA_OUTPUT was added.
DD_PRISMA_OUTPUT can be either the path to client start from the root of the project.
example:
root-folder
└── src
└── generated
in this case DD_PRISMA_OUTPUT would have the following value 'src/generated', if the the schema location is in the default prisma root folder or defined inside the package.json then DD_PRISMA_OUTPUT can be defined to 'auto' this will extract the output from the schema automatically.
Once the path is either provided by the user or extracted automatically, an absolute path is generated. This absolute path is used to register the hook. When ritm resolves the actual request, it uses returns the absolute path plus the filename it resolves to. Because of this, additional logic was added to match the hook using prefix-based matching whenever a registered module points to a specific file, later on the onrequire callback takes care of verifying if the complete path is a match.
With this changes Prisma's instrumentation will cover versions below and above v7 (specifically support for prisma-generator and prisma-generator-js).
Note: An additional PR has to be open to add tests for the new recommended prisma-generator, this prisma-generator generates typescript which can't be imported into js code and has to be transpiled into js before using.
Motivation
Have proper support for Prisma Client instrumentation
Plugin Checklist
Additional Notes