Skip to content

Commit 1bf3945

Browse files
linlinismetianhaowhujy2156121olof-nordcdfive
authored
sync master (#2)
* calculate process cpu usage to support application running in container environment * Enhance reliability and performance of InMemoryMetricsRepository (alibaba#1319) * Fix InMemoryMetricsRepository can't keep the last five minutes metrics data problem and Improve read-write performance * Use TimeUtil.currentTimeMillis() replace System.currentTimeMillis() for better performance * dashboard: Support setting value pattern for client IP and host in gateway flow rule dialog (alibaba#1325) * doc: Update JDK requirement of the dashboard in README.md (alibaba#1316) * Following discussions in alibaba#1315 * Add "web-context-unify" config in Spring WebMVC adapter to support "chain" relation flow strategy (alibaba#1328) * Fix the parsing issue in large post request for sentinel-transport-simple-http (alibaba#1255) * Add gateway adapter for Zuul 2.x (alibaba#1138) - also add demo for Zuul 2.x adapter * Polish code and demo of Sentinel Zuul 2.x adapter Signed-off-by: Eric Zhao <[email protected]> * Polish code of transport command centers and heartbeat senders Signed-off-by: Eric Zhao <[email protected]> * Polish logging SPI related code and add general JUL adapter for Logger SPI (alibaba#1338) * Move the legacy JUL methods from LogBase to BaseJulLogger. * Add a JavaLoggingAdapter as the general JUL adapter for the Logger SPI, which makes it convenient to use (as the default logger). * Add LoggerSpiProvider to resolve Logger SPI. * Polish the logback demo. Signed-off-by: Eric Zhao <[email protected]> * Move CommandCenterLog to sentinel-transport-common and polish related code (alibaba#1341) Signed-off-by: Eric Zhao <[email protected]> * Polish placeholders in logging content to slf4j convention (alibaba#1342) * Polish placeholders in logging content to "{}" Signed-off-by: Eric Zhao <[email protected]> * Fix timezone problem of sentinel-block.log Signed-off-by: Eric Zhao <[email protected]> * dashboard: Fix NoNodeException problem of FlowRuleZookeeperProvider example (alibaba#1352) * Introduce logging extension: slf4j (alibaba#1344) * Regroup packages related to logging into a separate module and polish document (alibaba#1355) * Fix CI failure in JDK 11 environment (alibaba#1360) * Supplement missing javax.annotation-api to sentinel-cluster-server-envoy-rls and sentinel-demo-zuul2-gateway * Upgrade mockito-core to 2.28.2 (up to date) * Fix the bug that context was not released when blocked in Spring Web adapter (alibaba#1353) * Improve standard output message in LogBase (alibaba#1357) * Complete the unit tests for sentinel-logging-slf4j module (alibaba#1358) * refactor: Make the ProcessorSlot itself as SPI and deprecate legacy slot chain builder (alibaba#411) * Make slots loaded by SPI, mark all slots with @SpiOrder from -10000 to -1000, improve comment * Reserve gateway and param slot chain builder (just extends DefaultSlotChainBuilder) and mark them as @deprecated * Force modifyRule command handler to fail if an incompatible old fastjson found (alibaba#1377) * Note that this is only a temporary solution. * Set default log level of JDK logging to INFO and polish code of SpiLoader (alibaba#1365) * Improve log info in SpiLoader, improve comment and test case * Use error level in catch block, init ArrayList with capacity and improve add item to list * doc: Polish README.md of sentinel-cluster-server-envoy-rls module Signed-off-by: Eric Zhao <[email protected]> * dashboard: Hide advanced options in flow rule dialog when cluster mode is enabled (alibaba#1367) * doc: Update README.md Signed-off-by: Eric Zhao <[email protected]> * Update fastjson to 1.2.68 Signed-off-by: Eric Zhao <[email protected]> * Bump version to 1.7.2 Signed-off-by: Eric Zhao <[email protected]> * Fix the bug of extracting request cookie in Spring Cloud Gateway adapter (alibaba#1400) * Bump version to 1.8.0-SNAPSHOT Signed-off-by: Eric Zhao <[email protected]> * Add JAX-RS adapter (alibaba#1396) * Fix the bug of misplaced locks in ContextUtil and ClusterNode (alibaba#1429) - which may lead to IllegalMonitorStateException in unlock() when unchecked error occurs during lock() * fix: Tracer does not trace exception to DefaultNode (alibaba#1068) * Support setting project.name via the properties file and deprecate legacy config path (alibaba#1412) * Update resolving logic of project name and polish SentinelConfig (alibaba#1437) Signed-off-by: Eric Zhao <[email protected]> * Refactor the mechanism of recording error in Entry and StatisticSlot * Also polish related complete callbacks Signed-off-by: Eric Zhao <[email protected]> * Polish Tracer with entry.setError(ex) mechanism Signed-off-by: Eric Zhao <[email protected]> * dashboard: Remove duplicate code in MetricEntity (alibaba#1441) * dashboard: Fix the bug that cookie may have conflict with web applications under the same domain (alibaba#1443) * Improve deprecated ParameterMetric purge mechanism (alibaba#1372) * Clear useless data in ParameterMetric for all removed rules * Polish code comments of the fundamental Sph/SphO/SphU class Signed-off-by: Eric Zhao <[email protected]> * Add OkHttp integration (alibaba#1456) * dashboard: Fix historical version compatibility problem for auth check via localStorage (alibaba#1473) * Add exceptionPredicate in Tracer for customized exception filtering logic (alibaba#1496) * test: Add test cases for Tuple2 (alibaba#1501) Signed-off-by: yunfeiyanggzq <[email protected]> * Add support for extracting param from complex object (alibaba#1491) * This could enable specified parameter flow control for customized objects. * Support setting class-level defaultFallback for annotation extension (alibaba#1493) * Add unit test for logging/TokenBucket (alibaba#1504) Signed-off-by: yunfeiyanggzq <[email protected]> * Fix sentinel-apache-dubbo-adapter full GC bug (alibaba#1431) * Polish RocketMQ PullConsumerDemo to make code clear (alibaba#1528) * Add unit test for cluster/FlowResponseDataDecoder (alibaba#1514) Signed-off-by: yunfeiyanggzq <[email protected]> * Improve consumer filter of Dubbo 2.6.x and 2.7.x adapter (alibaba#1532) * entry and exit with params in consumer filter * Polish sentinel-opensource-eco-landscape-en.png Signed-off-by: Eric Zhao <[email protected]> * Add annotation extension for Java EE CDI (alibaba#1541) * Add Sentinel annotation and JAX-RS plugins for Quarkus (alibaba#1542) * Add sentinel-quarkus-adapter module, which provides sentinel-annotation-quarkus-adapter and sentinel-jax-rs-quarkus-adapter to adapt sentinel-annotation-cdi-interceptor and sentinel-jax-rs-adapter for Quarkus. It also provides sentinel-native-image-quarkus-adapter to support running Sentinel with Quarkus in native image mode. * Polish document and code of Sentinel annotation CDI extension Signed-off-by: Eric Zhao <[email protected]> * Upgrade fastjson to 1.2.71 (alibaba#1545) * Add file.encoding JVM args in maven-surefire-plugin to avoid charset problem (alibaba#1550) * Add annotation CDI demo and Quarkus adapter demo (alibaba#1543) * Polish document and rearrange package for Quarkus and JAX-RS adapter Signed-off-by: Eric Zhao <[email protected]> * Support customized origin parser in legacy Dubbo 2.6.x adapter (alibaba#1555) * Add Eureka data-source extension (alibaba#1502) * Upgrade nacos-client version to 1.3.0 in sentinel-datasource-nacos (alibaba#1576) * demo: Update slot chain SPI demo (alibaba#1581) Signed-off-by: yunfeiyanggzq <[email protected]> * Add explicit null checking for charset in SimpleHttpClient#encodeRequestParams (alibaba#1589) * Adapter: Support Apache HttpClient (alibaba#1455) Introduce support through a customized client builder `SentinelApacheHttpClientBuilder`. * doc: Fix mistakes in README.md of sentinel-zuul-adapter (alibaba#1593) * Fix incorrect protocol description in FlowRequestData writer/decoder (alibaba#1607) Signed-off-by: yunfeiyanggzq <[email protected]> * Refactor config mechanism for OkHttp adapter and polish related code - One config per interceptor instead of the global config - Polish document and demo Signed-off-by: Eric Zhao <[email protected]> * test: Add unit test for sentinel-cluster-server and polish code (alibaba#1529) Signed-off-by: yunfeiyanggzq <[email protected]> * Refactor degrade hierarchy with new circuit breaker mechanism and improve strategy * Add `CircuitBreaker` abstraction (with half-open state) and add circuit breaker state change event observer support. * Improve circuit breaking strategy (avg RT → slow request ratio) and make statistics of each rule dependent (to support arbitrary statistic interval). * Add simple "trial" mechanism (aka. half-open). * Refactor mechanism of metric recording and state change handling for circuit breakers: record RT and error when requests have completed (i.e. `onExit`, based on alibaba#1420). Signed-off-by: Eric Zhao <[email protected]> * Update test cases for circuit breaking Signed-off-by: Eric Zhao <[email protected]> * Update demo for circuit breaking (DegradeRule) Signed-off-by: Eric Zhao <[email protected]> * test: Update test cases with new degrade mechanism in sentinel-demo-quarkus Signed-off-by: Eric Zhao <[email protected]> * Remove deprecated passCheck() in Rule and polish interface Signed-off-by: Eric Zhao <[email protected]> * Polish cluster flow control demo: add port in Nacos address (alibaba#1655) Signed-off-by: yunfeiyanggzq <[email protected]> * Polish boolean checking in test cases and dashboard (alibaba#1664) * Remove unused code in TokenServerHandler#channelActive (alibaba#1667) Signed-off-by: cj <[email protected]> * Optimize the order of slots in ProcessorSlot SPI config (alibaba#1649) * Fix the bug of circuit breaker half-open state transformation when request is blocked by upcoming rules (alibaba#1645) * Refactor the workflow to fix the bug that circuit breaker may remain half-open state forever when the request is blocked by upcoming rules: revert the state change in exit handler (as a temporary workaround) * Add exit handler in Entry as a per-invocation hook. * Polish CircuitBreaker interface and update comments - Only carry context in tryPass/onComplete method (this might be generic in upcoming versions) Signed-off-by: Eric Zhao <[email protected]> * Refactor exit handler mechanism of Entry - Rename: whenComplete -> whenTerminate - Execute the exit handler directly after the onExit hook of all slots Signed-off-by: Eric Zhao <[email protected]> * Add extended interface for metric extension hook to support distinguishing traffic type (alibaba#1665) - Add EntryType args to all hook methods * dashboard: Refactor degrade service/controller and adapt to new features Signed-off-by: Eric Zhao <[email protected]> * Polish Dubbo 2.6.x adapter and unify callback registry into DubboAdapterGlobalConfig (alibaba#1572) * Unify Dubbo callback registry (for fallback and origin parser) into DubboAdapterGlobalConfig * Polish default fallback implementation (wrap exception with RpcResult rather than directly throw it out) Signed-off-by: Eric Zhao <[email protected]> * Refactor extended MetricExtension interface (matching events in Sentinel) - Unify the extended interface as a few event handlers: onPass, onBlocked, onComplete and onError - Polish related code Signed-off-by: Eric Zhao <[email protected]> * Support customized origin parser in Apache Dubbo 2.7.x adapter and unify config (alibaba#1617) * Support customized origin parser in Apache Dubbo 2.7.x adapter * Unify Dubbo callback registry (for fallback and origin parser) into DubboAdapterGlobalConfig * Polish default fallback implementation (wrap exception with RpcResult rather than directly throw it out) * Polish code and README.md of sentinel-datasource-eureka Signed-off-by: Eric Zhao <[email protected]> * webmvc-adapter: improve to avoid ErrorEntryFreeException (alibaba#1533) If entry already exists in request just skip creation. * adapter: Add test cases for Spring WebFlux HandlerFunction (alibaba#1678) * Add RuntimeException converting method in BlockException and polish logic for validation Signed-off-by: Eric Zhao <[email protected]> * Fix NPE bug and improve default fallback in Dubbo 2.7.x adapter - Fix NPE bug in consumer filter (when non-biz error occurred) - Improve default fallback in Dubbo 2.7.x adapter: convert the BlockException to a simple RuntimeException (with necessary message) - Polish code and comments Signed-off-by: Eric Zhao <[email protected]> * Improve compatibility for dispatched servlet request in Spring Web adapter (alibaba#1681) * Bump version to 1.8.0 Signed-off-by: Eric Zhao <[email protected]> * Update README.md Signed-off-by: Eric Zhao <[email protected]> * Bump version to 1.8.1-SNAPSHOT Signed-off-by: Eric Zhao <[email protected]> * Fix typo in CircuitBreakingIntegrationTest (alibaba#1688) Signed-off-by: yunfeiyanggzq <[email protected]> * Pre-calculate intervalInSecond in LeapArray to reduce redundant calculation (alibaba#1700) * doc: Fix typo in code comments (alibaba#1721) * Solve the URI fetching bug in sentinel-zuul-adapter alibaba#1109 (alibaba#1605) Use `getRequestURI` instead of `getServletPath` to get URI of current request(Both in prefix and regex matching). * Fix NPE bug when updating gateway flow rules before the route/API has been requested once (alibaba#1729) * Make NettyTransportClient.getCurrentId() thread safe (alibaba#1707) Fix issue alibaba#1705. - Use CAS to make it thread safe and limited in the declared range. Signed-off-by: cj <[email protected]> * Add attributes of cluster concurrency limiting in ClusterFlowConfig Signed-off-by: yunfeiyanggzq <[email protected]> * Add concurrency token request/release operation in TokenService Signed-off-by: yunfeiyanggzq <[email protected]> * Add basic cluster concurrency limiting impl in token server module Signed-off-by: yunfeiyanggzq <[email protected]> * Add unit tests for cluster concurrent limiting checker Signed-off-by: yunfeiyanggzq <[email protected]> * doc: Fix content in README.md of sentinel-dashboard (alibaba#1737) * Fix the dependency conflict issue * Optimize logging statements using placeholder (alibaba#1736) * Optimize logging statements using placeholder to avoid unnecessary concatenation (issue alibaba#1735) * Polish document and name of parameter (alibaba#1738) - doc: Fix a typo in description of booting options for sentinel-dashboard - Fix mismatched name of parameter to its comment for VersionUtils.parseVersion() * Fix potential concurrency issue when updating flow rules (alibaba#1783) * test: Fix overrunning test `FlowRuleManagerTest.testLoadAndGetRules` (alibaba#1823) Signed-off-by: Jason Joo <[email protected]> * Improve default block fallback logic in Dubbo 2.6.x adapter to avoid serialization problem (alibaba#1794) - convert BlockException to a simple RuntimeException (with necessary message) * Fix the problem that requests will never be blocked when slowRatioThreshold = 100% (alibaba#1779) * CI: Polish dependencies for ARM64 and add ARM64 job to Travis CI (alibaba#1765) 1. Added ARM64 architecture in .travis.yml 2. Updated 'embedded-consul' version to 2.2.0, 'consul-api' version to 1.4.5 for ARM64 support. 3. Updated grpc.version for 'io.grpc:protoc-gen-grpc-java' to 1.30.2, for ARM64 support. Signed-off-by: odidev <[email protected]> * [feat alibaba#1839]: Make dashboard support deploying under subpath (alibaba#1851) * dashboard: Add statIntervalMs field in DegradeRule dialog (alibaba#1781) Co-authored-by: tianhao <[email protected]> Co-authored-by: jy2156121 <[email protected]> Co-authored-by: Olof <[email protected]> Co-authored-by: cdfive <[email protected]> Co-authored-by: Jason Joo <[email protected]> Co-authored-by: tao.zhang <[email protected]> Co-authored-by: Eric Zhao <[email protected]> Co-authored-by: WongTheo <[email protected]> Co-authored-by: 于玉桔 <[email protected]> Co-authored-by: Zhiguo.Chen <[email protected]> Co-authored-by: seasidesky <[email protected]> Co-authored-by: haifeng <[email protected]> Co-authored-by: johnli <[email protected]> Co-authored-by: zhenxianyimeng <[email protected]> Co-authored-by: pleasecheckhere2016 <[email protected]> Co-authored-by: ZhiQiang Gu <[email protected]> Co-authored-by: zechao zheng <[email protected]> Co-authored-by: yangy <[email protected]> Co-authored-by: xiby <[email protected]> Co-authored-by: iron_city <[email protected]> Co-authored-by: Bo <[email protected]> Co-authored-by: HupJ <[email protected]> Co-authored-by: Peine <[email protected]> Co-authored-by: cj <[email protected]> Co-authored-by: Bill Yip <[email protected]> Co-authored-by: liqiangz <[email protected]> Co-authored-by: mikawudi <[email protected]> Co-authored-by: dani3lWong <[email protected]> Co-authored-by: cj <[email protected]> Co-authored-by: yunfeiyanggzq <[email protected]> Co-authored-by: Luke <[email protected]> Co-authored-by: HelloCoCooo <[email protected]> Co-authored-by: nickChenyx <[email protected]> Co-authored-by: Weihua <[email protected]> Co-authored-by: 王振广 <[email protected]> Co-authored-by: Lynx <[email protected]> Co-authored-by: odidev <[email protected]> Co-authored-by: Brent <[email protected]>
1 parent 72bfe87 commit 1bf3945

File tree

544 files changed

+19152
-3474
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

544 files changed

+19152
-3474
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
out
55
gen
66

7+
# Visual Studio Code
8+
.history/
9+
710
# Maven
811
target/
912
pom.xml.tag

.travis.yml

+6
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,17 @@ matrix:
99
env: BUILD_JDK=ORACLE_JDK_8
1010
- jdk: oraclejdk11
1111
env: BUILD_JDK=ORACLE_JDK_11
12+
- arch: arm64
1213
allow_failures:
1314
- env: BUILD_JDK=ORACLE_JDK_11
1415

1516
# https://docs.travis-ci.com/user/languages/java/#maven-dependency-management
1617
install:
18+
- if [ "${TRAVIS_CPU_ARCH}" == "arm64" ]; then
19+
sudo apt-get install -y maven openjdk-11-jdk;
20+
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-arm64;
21+
export PATH=$JAVA_HOME/bin:$PATH;
22+
fi
1723
- mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V -DminimumPriority=1
1824

1925
after_success:

README.md

+18-11
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@
1111
## Introduction
1212

1313
As distributed systems become increasingly popular, the reliability between services is becoming more important than ever before.
14-
Sentinel takes "flow" as breakthrough point, and works on multiple fields including **flow control**, **circuit breaking** and **system adaptive protection**, to guarantee reliability of microservices.
14+
Sentinel takes "flow" as breakthrough point, and works on multiple fields including **flow control**,
15+
**traffic shaping**, **circuit breaking** and **system adaptive protection**, to guarantee reliability and resilience for microservices.
1516

1617
Sentinel has the following features:
1718

1819
- **Rich applicable scenarios**: Sentinel has been wildly used in Alibaba, and has covered almost all the core-scenarios in Double-11 (11.11) Shopping Festivals in the past 10 years, such as “Second Kill” which needs to limit burst flow traffic to meet the system capacity, message peak clipping and valley fills, circuit breaking for unreliable downstream services, cluster flow control, etc.
1920
- **Real-time monitoring**: Sentinel also provides real-time monitoring ability. You can see the runtime information of a single machine in real-time, and the aggregated runtime info of a cluster with less than 500 nodes.
2021
- **Widespread open-source ecosystem**: Sentinel provides out-of-box integrations with commonly-used frameworks and libraries such as Spring Cloud, Dubbo and gRPC. You can easily use Sentinel by simply add the adapter dependency to your services.
22+
- **Polyglot support**: Sentinel has provided native support for Java, [Go](https://github.com/alibaba/sentinel-golang) and [C++](https://github.com/alibaba/sentinel-cpp).
2123
- **Various SPI extensions**: Sentinel provides easy-to-use SPI extension interfaces that allow you to quickly customize your logic, for example, custom rule management, adapting data sources, and so on.
2224

2325
Features overview:
@@ -47,16 +49,16 @@ Below is a simple demo that guides new users to use Sentinel in just 3 steps. It
4749

4850
### 1. Add Dependency
4951

50-
**Note:** Sentinel requires Java 7 or later.
52+
**Note:** Sentinel Core requires Java 7 or later.
5153

52-
If your application is build in Maven, just add the following dependency in `pom.xml`.
54+
If your're using Maven, just add the following dependency in `pom.xml`.
5355

5456
```xml
5557
<!-- replace here with the latest version -->
5658
<dependency>
5759
<groupId>com.alibaba.csp</groupId>
5860
<artifactId>sentinel-core</artifactId>
59-
<version>1.7.1</version>
61+
<version>1.8.0</version>
6062
</dependency>
6163
```
6264

@@ -78,7 +80,7 @@ try (Entry entry = SphU.entry("HelloWorld")) {
7880
// try-with-resources auto exit
7981
```
8082

81-
So far the code modification is done. We also provide [annotation support module](https://github.com/alibaba/Sentinel/blob/master/sentinel-extension/sentinel-annotation-aspectj/README.md) to define resource easier.
83+
So far the code modification is done. We've also provided [annotation support module](https://github.com/alibaba/Sentinel/blob/master/sentinel-extension/sentinel-annotation-aspectj/README.md) to define resource easier.
8284

8385
### 3. Define Rules
8486

@@ -124,6 +126,8 @@ Samples can be found in the [sentinel-demo](https://github.com/alibaba/Sentinel/
124126

125127
### 5. Start Dashboard
126128

129+
> Note: Java 8 is required for building or running the dashboard.
130+
127131
Sentinel also provides a simple dashboard application, on which you can monitor the clients and configure the rules in real time.
128132

129133
![dashboard](https://user-images.githubusercontent.com/9434884/55449295-84866d80-55fd-11e9-94e5-d3441f4a2b63.png)
@@ -139,11 +143,11 @@ All the information can be found in [logs](https://github.com/alibaba/Sentinel/w
139143

140144
For bug report, questions and discussions please submit [GitHub Issues](https://github.com/alibaba/sentinel/issues).
141145

142-
Contact us: [email protected]
146+
Contact us via [Gitter](https://gitter.im/alibaba/Sentinel) or [Email](mailto:[email protected]).
143147

144148
## Contributing
145149

146-
Contributions are always welcomed! Please see [CONTRIBUTING](./CONTRIBUTING.md) for detailed guidelines.
150+
Contributions are always welcomed! Please refer to [CONTRIBUTING](./CONTRIBUTING.md) for detailed guidelines.
147151

148152
You can start with the issues labeled with [`good first issue`](https://github.com/alibaba/Sentinel/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22).
149153

@@ -155,18 +159,21 @@ And thanks for all [contributors](https://github.com/alibaba/Sentinel/graphs/con
155159

156160
## Who is using
157161

158-
These are only part of the companies using Sentinel, for reference only. If you are using Sentinel, please [add your company here](https://github.com/alibaba/Sentinel/issues/18) to tell us your scenario to make Sentinel better :)
162+
These are only part of the companies using Sentinel, for reference only.
163+
If you are using Sentinel, please [add your company here](https://github.com/alibaba/Sentinel/issues/18) to tell us your scenario to make Sentinel better :)
159164

160165
![Alibaba Group](https://docs.alibabagroup.com/assets2/images/en/global/logo_header.png)
166+
![AntFin](https://user-images.githubusercontent.com/9434884/90598732-30961c00-e226-11ea-8c86-0b1d7f7875c7.png)
161167
![Taiping Renshou](http://www.cntaiping.com/tplresource/cms/www/taiping/img/home_new/tp_logo_img.png)
168+
![拼多多](http://cdn.pinduoduo.com/assets/img/pdd_logo_v3.png)
169+
![爱奇艺](https://user-images.githubusercontent.com/9434884/90598445-a51c8b00-e225-11ea-9327-3543525f3f2a.png)
162170
![Shunfeng Technology](https://user-images.githubusercontent.com/9434884/48463502-2f48eb80-e817-11e8-984f-2f9b1b789e2d.png)
163-
![Mandao](https://user-images.githubusercontent.com/9434884/48463559-6cad7900-e817-11e8-87e4-42952b074837.png)
164-
![每日优鲜](https://home.missfresh.cn/statics/img/logo.png)
165171
![二维火](https://user-images.githubusercontent.com/9434884/49358468-bc43de00-f70d-11e8-97fe-0bf05865f29f.png)
172+
![Mandao](https://user-images.githubusercontent.com/9434884/48463559-6cad7900-e817-11e8-87e4-42952b074837.png)
166173
![文轩在线](http://static.winxuancdn.com/css/v2/images/logo.png)
167174
![客如云](https://www.keruyun.com/static/krynew/images/logo.png)
168175
![亲宝宝](https://stlib.qbb6.com/wclt/img/home_hd/version1/title_logo.png)
169176
![杭州光云科技](https://www.raycloud.com/images/logo.png)
170177
![金汇金融](https://res.jinhui365.com/r/images/logo2.png?v=1.527)
171178
![闪电购](http://cdn.52shangou.com/shandianbang/official-source/3.1.1/build/images/logo.png)
172-
![拼多多](http://cdn.pinduoduo.com/assets/img/pdd_logo_v3.png)
179+
Loading

pom.xml

+14-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>com.alibaba.csp</groupId>
77
<artifactId>sentinel-parent</artifactId>
8-
<version>1.7.2-SNAPSHOT</version>
8+
<version>1.8.1-SNAPSHOT</version>
99
<packaging>pom</packaging>
1010

1111
<name>${project.artifactId}</name>
@@ -41,11 +41,12 @@
4141

4242
<properties>
4343
<!-- Compile libs -->
44-
<fastjson.version>1.2.62</fastjson.version>
44+
<fastjson.version>1.2.71</fastjson.version>
45+
<javax.annotation-api.version>1.3.2</javax.annotation-api.version>
4546

4647
<!-- Test libs -->
4748
<junit.version>4.12</junit.version>
48-
<mockito.version>2.21.0</mockito.version>
49+
<mockito.version>2.28.2</mockito.version>
4950
<assertj.version>3.12.1</assertj.version>
5051
<awaitility.version>3.1.5</awaitility.version>
5152
<powermock.version>2.0.0</powermock.version>
@@ -71,11 +72,14 @@
7172
<module>sentinel-extension</module>
7273
<module>sentinel-transport</module>
7374
<module>sentinel-adapter</module>
75+
<module>sentinel-cluster</module>
76+
<module>sentinel-logging</module>
77+
7478
<module>sentinel-dashboard</module>
7579

7680
<module>sentinel-demo</module>
7781
<module>sentinel-benchmark</module>
78-
<module>sentinel-cluster</module>
82+
7983
</modules>
8084

8185
<dependencyManagement>
@@ -95,6 +99,11 @@
9599
<artifactId>sentinel-annotation-aspectj</artifactId>
96100
<version>${project.version}</version>
97101
</dependency>
102+
<dependency>
103+
<groupId>com.alibaba.csp</groupId>
104+
<artifactId>sentinel-annotation-cdi-interceptor</artifactId>
105+
<version>${project.version}</version>
106+
</dependency>
98107
<dependency>
99108
<groupId>com.alibaba.csp</groupId>
100109
<artifactId>sentinel-parameter-flow-control</artifactId>
@@ -263,6 +272,7 @@
263272
<configuration>
264273
<!-- CircleCI build workaround -->
265274
<argLine>@{argLine} -Xms1024m -Xmx2048m</argLine>
275+
<argLine>-Dfile.encoding=UTF-8</argLine>
266276
<useSystemClassLoader>false</useSystemClassLoader>
267277
</configuration>
268278
</plugin>

sentinel-adapter/pom.xml

+6-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>com.alibaba.csp</groupId>
99
<artifactId>sentinel-parent</artifactId>
10-
<version>1.7.2-SNAPSHOT</version>
10+
<version>1.8.1-SNAPSHOT</version>
1111
</parent>
1212
<artifactId>sentinel-adapter</artifactId>
1313
<packaging>pom</packaging>
@@ -18,6 +18,7 @@
1818
<module>sentinel-web-servlet</module>
1919
<module>sentinel-dubbo-adapter</module>
2020
<module>sentinel-apache-dubbo-adapter</module>
21+
<module>sentinel-apache-httpclient-adapter</module>
2122
<module>sentinel-sofa-rpc-adapter</module>
2223
<module>sentinel-grpc-adapter</module>
2324
<module>sentinel-zuul-adapter</module>
@@ -26,6 +27,10 @@
2627
<module>sentinel-api-gateway-adapter-common</module>
2728
<module>sentinel-spring-cloud-gateway-adapter</module>
2829
<module>sentinel-spring-webmvc-adapter</module>
30+
<module>sentinel-zuul2-adapter</module>
31+
<module>sentinel-okhttp-adapter</module>
32+
<module>sentinel-jax-rs-adapter</module>
33+
<module>sentinel-quarkus-adapter</module>
2934
</modules>
3035

3136
<dependencyManagement>

sentinel-adapter/sentinel-apache-dubbo-adapter/README.md

+14-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Sentinel Apache Dubbo Adapter
1+
# Sentinel Apache Dubbo Adapter (for 2.7.x+)
22

33
> Note: 中文文档请见[此处](https://github.com/alibaba/Sentinel/wiki/主流框架的适配#dubbo)
44
@@ -21,7 +21,7 @@ To use Sentinel Dubbo Adapter, you can simply add the following dependency to yo
2121
The Sentinel filters are **enabled by default**. Once you add the dependency,
2222
the Dubbo services and methods will become protected resources in Sentinel,
2323
which can leverage Sentinel's flow control and guard ability when rules are configured.
24-
Demos can be found in [sentinel-demo-dubbo](https://github.com/alibaba/Sentinel/tree/master/sentinel-demo/sentinel-demo-dubbo).
24+
Demos can be found in [sentinel-demo-apache-dubbo](https://github.com/alibaba/Sentinel/tree/master/sentinel-demo/sentinel-demo-apache-dubbo).
2525

2626
If you don't want the filters enabled, you can manually disable them. For example:
2727

@@ -37,8 +37,8 @@ For more details of Dubbo filter, see [here](http://dubbo.apache.org/en-us/docs/
3737

3838
The resource for Dubbo services has two granularities: service interface and service method.
3939

40-
- Service interfaceresourceName format is `interfaceName`e.g. `com.alibaba.csp.sentinel.demo.dubbo.FooService`
41-
- Service methodresourceName format is `interfaceName:methodSignature`e.g. `com.alibaba.csp.sentinel.demo.dubbo.FooService:sayHello(java.lang.String)`
40+
- Service interface: resourceName format is `interfaceName`, e.g. `com.alibaba.csp.sentinel.demo.dubbo.FooService`
41+
- Service method: resourceName format is `interfaceName:methodSignature`, e.g. `com.alibaba.csp.sentinel.demo.dubbo.FooService:sayHello(java.lang.String)`
4242

4343
## Flow control based on caller
4444

@@ -52,17 +52,21 @@ If `limitApp` of flow rules is not configured (`default`), flow control will tak
5252
If `limitApp` of a flow rule is configured with a caller, then the corresponding flow rule will only take effect on the specific caller.
5353

5454
> Note: Dubbo consumer does not provide its Dubbo application name when doing RPC,
55-
so developers should manually put the application name into *attachment* at consumer side,
56-
then extract it at provider side. Sentinel Dubbo Adapter has implemented a filter (`DubboAppContextFilter`)
57-
where consumer can carry application name information to provider automatically.
58-
If the consumer does not use Sentinel Dubbo Adapter but requires flow control based on caller, developers can manually put the application name into attachment with the key `dubboApplication`.
55+
> so developers should manually put the application name into *attachment* at consumer side,
56+
> then extract it at provider side. Sentinel Dubbo Adapter has implemented a filter (`DubboAppContextFilter`)
57+
> where consumer can carry application name information to provider automatically.
58+
> If the consumer does not use Sentinel Dubbo Adapter but requires flow control based on caller,
59+
> developers can manually put the application name into attachment with the key `dubboApplication`.
60+
>
61+
> Since 1.8.0, the adapter provides support for customizing origin parsing logic. You may register your own `DubboOriginParser`
62+
> implementation to `DubboAdapterGlobalConfig`.
5963
6064
## Global fallback
6165

6266
Sentinel Dubbo Adapter supports global fallback configuration.
6367
The global fallback will handle exceptions and give replacement result when blocked by
6468
flow control, degrade or system load protection. You can implement your own `DubboFallback` interface
65-
and then register to `DubboFallbackRegistry`. If no fallback is configured, Sentinel will wrap the `BlockException`
66-
then directly throw it out.
69+
and then register to `DubboAdapterGlobalConfig`.
70+
If no fallback is configured, Sentinel will wrap the `BlockException` as the fallback result.
6771

6872
Besides, we can also leverage [Dubbo mock mechanism](http://dubbo.apache.org/en-us/docs/user/demos/local-mock.html) to provide fallback implementation of degraded Dubbo services.

sentinel-adapter/sentinel-apache-dubbo-adapter/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>sentinel-adapter</artifactId>
77
<groupId>com.alibaba.csp</groupId>
8-
<version>1.7.2-SNAPSHOT</version>
8+
<version>1.8.1-SNAPSHOT</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

sentinel-adapter/sentinel-apache-dubbo-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/dubbo/BaseSentinelDubboFilter.java

+20-52
Original file line numberDiff line numberDiff line change
@@ -16,66 +16,34 @@
1616
package com.alibaba.csp.sentinel.adapter.dubbo;
1717

1818

19-
import com.alibaba.csp.sentinel.Entry;
20-
import com.alibaba.csp.sentinel.Tracer;
21-
import com.alibaba.csp.sentinel.adapter.dubbo.config.DubboConfig;
22-
import com.alibaba.csp.sentinel.context.ContextUtil;
23-
import org.apache.dubbo.common.URL;
24-
import org.apache.dubbo.common.constants.CommonConstants;
25-
import org.apache.dubbo.rpc.*;
19+
import org.apache.dubbo.rpc.Filter;
20+
import org.apache.dubbo.rpc.Invocation;
21+
import org.apache.dubbo.rpc.Invoker;
2622

2723
/**
28-
* Base Class of the {@link SentinelDubboProviderFilter} and {@link SentinelDubboConsumerFilter}.
24+
* Base class of the {@link SentinelDubboProviderFilter} and {@link SentinelDubboConsumerFilter}.
2925
*
3026
* @author Zechao Zheng
3127
*/
28+
public abstract class BaseSentinelDubboFilter implements Filter {
3229

33-
public abstract class BaseSentinelDubboFilter extends ListenableFilter {
34-
public BaseSentinelDubboFilter() {
35-
this.listener = new SentinelDubboListener();
36-
}
3730

38-
static class SentinelDubboListener implements Listener {
31+
/**
32+
* Get method name of dubbo rpc
33+
*
34+
* @param invoker
35+
* @param invocation
36+
* @return
37+
*/
38+
abstract String getMethodName(Invoker invoker, Invocation invocation, String prefix);
3939

40-
public void onResponse(Result appResponse, Invoker<?> invoker, Invocation invocation) {
41-
onSuccess(appResponse, invoker);
42-
}
40+
/**
41+
* Get interface name of dubbo rpc
42+
*
43+
* @param invoker
44+
* @return
45+
*/
46+
abstract String getInterfaceName(Invoker invoker, String prefix);
4347

44-
//for compatible dubbo 2.7.5 rename onResponse to onMessage
45-
public void onMessage(Result appResponse, Invoker<?> invoker, Invocation invocation) {
46-
onSuccess(appResponse, invoker);
47-
}
4848

49-
private void onSuccess(Result appResponse, Invoker<?> invoker) {
50-
if (DubboConfig.getDubboBizExceptionTraceEnabled()) {
51-
traceAndExit(appResponse.getException(), invoker.getUrl());
52-
} else {
53-
traceAndExit(null, invoker.getUrl());
54-
}
55-
}
56-
57-
@Override
58-
public void onError(Throwable t, Invoker<?> invoker, Invocation invocation) {
59-
traceAndExit(t, invoker.getUrl());
60-
}
61-
62-
}
63-
64-
static void traceAndExit(Throwable throwable, URL url) {
65-
Entry interfaceEntry = (Entry) RpcContext.getContext().get(DubboUtils.DUBBO_INTERFACE_ENTRY_KEY);
66-
Entry methodEntry = (Entry) RpcContext.getContext().get(DubboUtils.DUBBO_METHOD_ENTRY_KEY);
67-
if (methodEntry != null) {
68-
Tracer.traceEntry(throwable, methodEntry);
69-
methodEntry.exit();
70-
RpcContext.getContext().remove(DubboUtils.DUBBO_METHOD_ENTRY_KEY);
71-
}
72-
if (interfaceEntry != null) {
73-
Tracer.traceEntry(throwable, interfaceEntry);
74-
interfaceEntry.exit();
75-
RpcContext.getContext().remove(DubboUtils.DUBBO_INTERFACE_ENTRY_KEY);
76-
}
77-
if (CommonConstants.PROVIDER_SIDE.equals(url.getParameter(CommonConstants.SIDE_KEY))) {
78-
ContextUtil.exit();
79-
}
80-
}
8149
}

0 commit comments

Comments
 (0)