-
Notifications
You must be signed in to change notification settings - Fork 21.7k
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
Allow filtering params based on parent keys #13897
Conversation
This is an alternative take on #13670 |
@tenderlove, you're the last one to have worked on this. Any thoughts? |
👍 |
param_filter is a hotspot for perf which is why I took care to remove as much logic from |
I'll benchmark it. |
You were right that it was much slower. The updated patch is a bit larger, but the performances are roughly the same as master. The params have synthetic depth of N.
here's the script for the benchmark: https://gist.github.com/gmalette/9367909 |
Has any thought been given to this? We've been running it for a while now |
What is the slowest part of the new code? is this going to effect all apps, or only the ones that use this new feature? |
df7f383
to
b067568
Compare
The slowest part of the new code is the line that assembles the new key and runs the regex. People not using the feature will not be impacted. The slowdown for people not using the feature comes from the management of parent keys for each new level of nesting. As shown in the current benchmarks, the impact is minimal. Here are benchmarks for Ruby 2.2.1 (same code, but using IPS)
|
@gmalette Sounds good to me. Can you add a changelog before I merge it? |
Add the possibility to only filter parameters based on their full path instead of relying on the immediate key. config.filter_parameters += ['credit_card.code'] { 'credit_card' => { 'code' => '[FILTERED]' }, 'source' => { 'code' => '<%= puts 5 %>' } }
b067568
to
33b9317
Compare
updated |
Allow filtering params based on parent keys
Merci beaucoup . |
Add documentation for #13897 [skip ci]
Some parameters on APIs have ambiguous names
that cannot be filtered altogether.
For example, it makes sense not to filter :code in
It makes sense however to filter it in
This PR allows doing so by using