-
Notifications
You must be signed in to change notification settings - Fork 619
fix(pg-instrumentation): capture query values when passed as second argument for prepared statements #3196
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
Conversation
…rgument for prepared statements
|
@maryliag Could you please take a look at this PR? TIA |
|
|
||
| const instrumentationConfig = plugin.getConfig(); | ||
|
|
||
| // Normalize the query configuration so that prepared statements with a separate |
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.
I like the suggestion on the issue itself, of just updating the line 342 to
values: (arg0 as any).values ?? (Array.isArray(args[1]) ? args[1] : undefined),, this way it avoids doing some repetition on checks, which is what you're doing here.
Would you mind making that solutions instead and checking if the tests will work as expected?
maryliag
left a comment
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.
Awesome! Thank you!
|
Thank you for your contribution @aryamohanan! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey. |
Which problem is this PR solving?
Fixes #3193
When using prepared statements with the following syntax, query parameter values were not captured even when
enhancedDatabaseReporting: truewas enabled:Short description of the changes
args[1]) when the first argument is a query config object.db.postgresql.valuesis only recorded whenenhancedDatabaseReporting:true.$1,$2, etc.) remain indb.statement.