-
Notifications
You must be signed in to change notification settings - Fork 539
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.80% 90.87% +0.06%
==========================================
Files 169 169
Lines 8026 8042 +16
Branches 1635 1635
==========================================
+ Hits 7288 7308 +20
+ Misses 738 734 -4
|
71e08b3
to
5cd3b7c
Compare
import { PgInstrumentation } from '../../build/src/index.js'; | ||
|
||
const CONFIG = { | ||
user: process.env.POSTGRES_USER || 'postgres', |
Check failure
Code scanning / CodeQL
Hard-coded credentials Critical test
user name
|
||
const CONFIG = { | ||
user: process.env.POSTGRES_USER || 'postgres', | ||
password: process.env.POSTGRES_PASSWORD || 'postgres', |
Check failure
Code scanning / CodeQL
Hard-coded credentials Critical test
password
8ea56bd
to
13bbbcc
Compare
13bbbcc
to
21840f9
Compare
44988a3
to
ba9fafa
Compare
4dfc927
to
e6818f6
Compare
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.