-
Notifications
You must be signed in to change notification settings - Fork 544
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
feat(pg): Patch client inside lib
and lib/pg-native
#2563
base: main
Are you sure you want to change the base?
feat(pg): Patch client inside lib
and lib/pg-native
#2563
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2563 +/- ##
==========================================
+ Coverage 90.79% 90.91% +0.11%
==========================================
Files 169 169
Lines 8059 8075 +16
Branches 1645 1645
==========================================
+ Hits 7317 7341 +24
+ Misses 742 734 -8
|
71e08b3
to
5cd3b7c
Compare
plugins/node/opentelemetry-instrumentation-pg/test/fixtures/use-pg.mjs
Dismissed
Show dismissed
Hide dismissed
plugins/node/opentelemetry-instrumentation-pg/test/fixtures/use-pg.mjs
Dismissed
Show dismissed
Hide dismissed
8ea56bd
to
13bbbcc
Compare
13bbbcc
to
21840f9
Compare
44988a3
to
ba9fafa
Compare
4dfc927
to
e6818f6
Compare
I'd very much like to support this PR getting merged. It solves a problem I am seeing where pg-native is not sending traces when the |
cc @maryliag (component owner) 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, nice work working on this. I added a few questions :)
There was a problem hiding this 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!
Which problem is this PR solving?
Ref:
Debugging the reproduction of getsentry/sentry-javascript#14238, it seems
@opentelemetry/instrumentation-pg
fails to pick up thepg
module while it successfully picks up and patchespg-pool
.Digging into
node_modules
of the reproduction,pg
package did not have an index on its root, and the whole implementation resides inlib
. Which made me suspect that relying on the root exports may not be enough with certain bundlers (Vite in this case) and runtimes. Instrumenting the client file instead worked well and spans were created successfully.The same applies to
pg-native
whichpg
has bindings insidelib/native
. So it's possible to patch it from thepg
itself. That is similar to the approach Sentry was using to instrumentpg-native
before migrating to OTEL.Short description of the changes
lib/client.js
andlib/native/client.js
on top of the original implementation.