Add the feature of excluding unused URLs in CommonFilter (#287) - #914
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## master #914 +/- ##
============================================
- Coverage 42.58% 42.49% -0.09%
+ Complexity 1443 1440 -3
============================================
Files 310 310
Lines 8992 8993 +1
Branches 1221 1222 +1
============================================
- Hits 3829 3822 -7
- Misses 4696 4701 +5
- Partials 467 470 +3
Continue to review full report at Codecov.
|
sczyh30
reviewed
Jul 15, 2019
Member
|
And could you please also update the document here: https://github.com/alibaba/Sentinel/blob/master/sentinel-adapter/sentinel-web-servlet/README.md |
cdfive
reviewed
Jul 16, 2019
Member
|
@lym-ifae The CI status indicates there's something wrong with your changes: https://travis-ci.org/alibaba/Sentinel/builds/559316648 |
sczyh30
requested changes
Jul 16, 2019
Member
|
Thanks for contributing! 👍 |
sczyh30
pushed a commit
that referenced
this pull request
Jul 29, 2019
(cherry picked from commit 7dd20dd)
CST11021
pushed a commit
to CST11021/Sentinel
that referenced
this pull request
Nov 3, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why we need it
We need to support filtering urls that don't want to be resource in
CommonFilter.Does this pull request fix one issue?
Resolves #287
Describe how you did it
As there's already a UrlCleaner interface, we could just reuse the interface and improve the logic of unifying the resource name with UrlCleaner. If developers are going to exclude some URLs, they can convert the URLs to the empty string "" in their
UrlCleanerimplementation, and inCommonFilterwe could check whether the cleaned resource name is empty. If it's empty, then it should be excluded and won't go through the logic of SentinelSphU.entry.Describe how to verify it
We can get the statistic node of the resource via
ClusterBuilderSlot.getClusterNode(res)method, and if theClusterNodeof the target URL is absent, then we think it has been excluded.Special notes for reviews