Skip to content

Add Sentinel Spring WebFlux adapter module - #556

Merged
sczyh30 merged 3 commits into
masterfrom
adapter/spring-webflux
Mar 11, 2019
Merged

Add Sentinel Spring WebFlux adapter module#556
sczyh30 merged 3 commits into
masterfrom
adapter/spring-webflux

Conversation

@sczyh30

@sczyh30 sczyh30 commented Mar 8, 2019

Copy link
Copy Markdown
Member

Describe what this PR does / why we need it

Add Sentinel Spring WebFlux adapter to support integration with Spring WebFlux (reactive). I've also provided a demo for it.

Does this pull request fix one issue?

Resolves #230

Describe how you did it

  • Add a SentinelWebFluxFilter to intercept the request and wrap with Sentinel using Sentinel Reactor transformer.
  • Implement a SentinelBlockExceptionHandler that will handle the BlockException and return a default message body by default.

Default message body resembles:

{"code":429,"message":"Blocked by Sentinel: FlowException"}

Describe how to verify it

Run the test cases.

Special notes for reviews

Plz run the demo in local to see whether it works correctly.

@sczyh30 sczyh30 added the to-review To review label Mar 8, 2019
@sczyh30 sczyh30 added this to the 1.5.0 milestone Mar 8, 2019
@sczyh30
sczyh30 force-pushed the adapter/spring-webflux branch from fe52e30 to 14e839c Compare March 11, 2019 03:38
@codecov-io

codecov-io commented Mar 11, 2019

Copy link
Copy Markdown

Codecov Report

Merging #556 into master will increase coverage by 1.06%.
The diff coverage is 83.56%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #556      +/-   ##
============================================
+ Coverage     38.31%   39.38%   +1.06%     
- Complexity     1158     1210      +52     
============================================
  Files           267      271       +4     
  Lines          8414     8499      +85     
  Branches       1133     1134       +1     
============================================
+ Hits           3224     3347     +123     
+ Misses         4777     4727      -50     
- Partials        413      425      +12
Impacted Files Coverage Δ Complexity Δ
.../adapter/spring/webflux/SentinelWebFluxFilter.java 100% <100%> (ø) 5 <5> (?)
...pring/webflux/callback/WebFluxCallbackManager.java 100% <100%> (ø) 11 <11> (?)
...bflux/exception/SentinelBlockExceptionHandler.java 66.66% <66.66%> (ø) 6 <6> (?)
...g/webflux/callback/DefaultBlockRequestHandler.java 70.83% <70.83%> (ø) 4 <4> (?)
...l/cluster/server/connection/ConnectionManager.java 76% <0%> (+2%) 11% <0%> (+1%) ⬆️
.../src/main/java/com/alibaba/csp/sentinel/Entry.java 94.11% <0%> (+3.2%) 21% <0%> (+9%) ⬆️
... and 2 more

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 7367da6...fdeb4de. Read the comment docs.

sczyh30 added 3 commits March 11, 2019 14:09
- The implementation leverages Sentinel Reactor Adapter. Two main components: SentinelWebFluxFilter and SentinelBlockExceptionHandler

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
@sczyh30
sczyh30 force-pushed the adapter/spring-webflux branch from 14e839c to fdeb4de Compare March 11, 2019 06:09
@sczyh30 sczyh30 added the size/XXL Indicate a PR that changes 1000+ lines. label Mar 11, 2019

@CarpenterLee CarpenterLee left a comment

Copy link
Copy Markdown
Contributor

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 efcd877 into master Mar 11, 2019
@sczyh30 sczyh30 removed the to-review To review label Mar 11, 2019
@sczyh30
sczyh30 deleted the adapter/spring-webflux branch March 11, 2019 11:46
CST11021 pushed a commit to CST11021/Sentinel that referenced this pull request Nov 3, 2021
[ISSUE alibaba#556]Fix useEpollNativeSelector=true Broker Start Exception
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XXL Indicate a PR that changes 1000+ lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

please support running sentinel client in a reactive Spring WebFlux environment

3 participants