Skip to content
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

Add the feature of excluding unused URLs in CommonFilter (#287) #914

Merged
merged 3 commits into from
Jul 16, 2019

Conversation

lym-ifae
Copy link
Contributor

@lym-ifae lym-ifae commented Jul 15, 2019

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 UrlCleaner implementation, and in CommonFilter we 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 Sentinel SphU.entry.

Describe how to verify it

We can get the statistic node of the resource via ClusterBuilderSlot.getClusterNode(res) method, and if the ClusterNode of the target URL is absent, then we think it has been excluded.

Special notes for reviews

@CLAassistant
Copy link

CLAassistant commented Jul 15, 2019

CLA assistant check
All committers have signed the CLA.

@codecov-io
Copy link

codecov-io commented Jul 15, 2019

Codecov Report

Merging #914 into master will decrease coverage by 0.08%.
The diff coverage is 100%.

Impacted file tree graph

@@             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
Impacted Files Coverage Δ Complexity Δ
...aba/csp/sentinel/adapter/servlet/CommonFilter.java 75% <100%> (+0.58%) 10 <0> (+1) ⬆️
...ava/com/alibaba/csp/sentinel/node/ClusterNode.java 95.23% <0%> (-4.77%) 7% <0%> (-1%)
...a/csp/sentinel/slots/statistic/base/LeapArray.java 67.32% <0%> (-2.98%) 33% <0%> (-1%)
...tinel/slots/block/flow/param/ParamFlowChecker.java 52.7% <0%> (-2.71%) 28% <0%> (-1%)
...ain/java/com/alibaba/csp/sentinel/log/LogBase.java 56.94% <0%> (ø) 10% <0%> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 326dd44...9dec9ea. Read the comment docs.

@sczyh30 sczyh30 added the to-review To review label Jul 15, 2019
@sczyh30
Copy link
Member

sczyh30 commented Jul 15, 2019

sczyh30
sczyh30 previously approved these changes Jul 16, 2019
Copy link
Member

@sczyh30 sczyh30 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sczyh30 sczyh30 dismissed their stale review July 16, 2019 08:18

Found another incorrect logic

@sczyh30
Copy link
Member

sczyh30 commented Jul 16, 2019

@lym-ifae The CI status indicates there's something wrong with your changes: https://travis-ci.org/alibaba/Sentinel/builds/559316648

Copy link
Member

@sczyh30 sczyh30 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sczyh30 sczyh30 merged commit 7dd20dd into alibaba:master Jul 16, 2019
@sczyh30 sczyh30 added kind/enhancement Category issues or prs related to enhancement. and removed to-review To review labels Jul 16, 2019
@sczyh30
Copy link
Member

sczyh30 commented Jul 16, 2019

Thanks for contributing! 👍

@sczyh30 sczyh30 added this to the 1.7.0 milestone Jul 16, 2019
@sczyh30 sczyh30 modified the milestones: 1.7.0, 1.6.3 Jul 25, 2019
sczyh30 pushed a commit that referenced this pull request Jul 29, 2019
CST11021 pushed a commit to CST11021/Sentinel that referenced this pull request Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Category issues or prs related to enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CommonFilter provides interface to exclude some unused URLs
5 participants