FEATURE: Allow skip_paths config to contain regular expressions #461
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@SamSaffron when I was trying to enable snapshots on Discourse, I noticed we don't use Mini Profiler's
skip_paths
config but instead use
pre_authorize_cb
to skip paths:https://github.com/discourse/discourse/blob/90eeb8f7d95bf8e06adb34acbbb65e2c743e551f/config/initializers/006-mini_profiler.rb#L53-L58
We also use
pre_authorize_cb
to disable profiling on phones/tablets.Skipping paths in
pre_authorize_cb
is problematic for snapshotting because requests that fail thepre_authorize_cb
check are eligible for snapshotting, and we do want requests from phones/tablets to be eligible for snapshotting, but we never want (I think) requests to skipped paths to be eligible for snapshotting (e.g. I don't think we want snapshots for assets requests).The only thing stopping us from using
skip_paths
is that we want regular expressions butskip_paths
currently accepts strings only. This PR allows both strings and regular expressions inskip_paths
.