-
-
Notifications
You must be signed in to change notification settings - Fork 521
fix(rails): fix logging of cached queries with binds #2789
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,7 +50,7 @@ def sql(event) | |
|
|
||
| binds = event.payload[:binds] | ||
|
|
||
| if Sentry.configuration.send_default_pii && binds&.any? | ||
| if Sentry.configuration.send_default_pii && (binds && !binds.empty?) | ||
| type_casted_binds = type_casted_binds(event) | ||
|
|
||
| binds.each_with_index do |bind, index| | ||
|
|
@@ -75,13 +75,15 @@ def sql(event) | |
| ) | ||
| end | ||
|
|
||
| if RUBY_ENGINE == "jruby" | ||
| def type_casted_binds(event) | ||
| event.payload[:type_casted_binds].call | ||
| end | ||
| else | ||
| def type_casted_binds(event) | ||
| event.payload[:type_casted_binds] | ||
| def type_casted_binds(event) | ||
| binds = event.payload[:type_casted_binds] | ||
|
|
||
| # When a query is cached, binds are a callable, | ||
| # and under JRuby they're always a callable. | ||
| if binds.respond_to?(:call) | ||
| binds.call | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does that mean in the cached case, we will incur extra overhead to fetch the binds?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sl0thentr0py a bit, but it's hard to tell what the impact is w/o measuring it. Want me to check?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would be great!
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sl0thentr0py we good amigo 😄
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks for checking!
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks for checking! |
||
| else | ||
| binds | ||
| end | ||
| end | ||
|
|
||
|
|
||

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.
More verbose but actually faster