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 OkHttp integration #1456

Merged
merged 18 commits into from
May 15, 2020
Merged

Add OkHttp integration #1456

merged 18 commits into from
May 15, 2020

Conversation

zhaoyuguang
Copy link
Collaborator

resolve #1435

@sczyh30 sczyh30 added area/integrations Issues or PRs related to integrations with open-source components to-review To review labels May 6, 2020
@sczyh30 sczyh30 requested review from sczyh30 and cdfive May 6, 2020 15:06
sentinel-adapter/sentinel-okhttp-adapter/pom.xml Outdated Show resolved Hide resolved
* @author zhaoyuguang
*/

public interface OkHttpUrlCleaner {
Copy link
Member

Choose a reason for hiding this comment

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

How about OkHttpResourceExtractor or other better?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

是的,class name和method名称修改了


@Override
public String clean(Request request, Connection connection) {
return request.url().toString();
Copy link
Member

Choose a reason for hiding this comment

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

How about carrying HTTP method prefix in the resource name? And it could be better if users could add customized prefix here (e.g. okhttp:xxx).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

恩 默认的DefaultOkHttpResourceExtractor 增加了HTTP METHOD+":"的记录,且增加了 config里面的prefix属性 默认""

/**
* @author zhaoyuguang
*/

Copy link
Member

Choose a reason for hiding this comment

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

Remove the redundant blank line?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

Comment on lines 37 to 49
public static void setPrefix(String prefix) {
AssertUtil.notNull(extractor, "prefix cannot be null");
SentinelOkHttpConfig.prefix = prefix;
}

public static OkHttpResourceExtractor getExtractor() {
return extractor;
}

public static void setExtractor(OkHttpResourceExtractor extractor) {
AssertUtil.notNull(extractor, "cleaner cannot be null");
SentinelOkHttpConfig.extractor = extractor;
}
Copy link
Collaborator

@cdfive cdfive May 7, 2020

Choose a reason for hiding this comment

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

#Line38 check not null for prefix not extractor.
#Line47 OkHttpResourceExtractor, extractor and cleaner seems not very uniform, but it's OK : )
@see SentinelOkHttpConfigTest#testConfigSetPrefix.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

code & testcase 修复了, 写正规以免有歧义

@@ -0,0 +1,63 @@
# Sentinel Spring OkHttp Adapter
Copy link
Collaborator

Choose a reason for hiding this comment

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

Spring is used for only unit test, here whether it can be removed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

copy 别的 readme 忘记删了

Comment on lines 67 to 68
</dependencies>
</project>
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's better to indent here, make the format good looking.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

Comment on lines 1 to 2
/*
* Copyright 1999-2018 Alibaba Group Holding Ltd.
Copy link
Collaborator

Choose a reason for hiding this comment

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

1999-2020 is better, since time goes by.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

恩 暂且吧本提交涉及的改了

Comment on lines 20 to 23
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-core</artifactId>
</dependency>
Copy link
Collaborator

Choose a reason for hiding this comment

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

This can be omitted in demo, since sentinel-okhttp-adapter has the dependency. Adding it is all right, but new user will feel uncertain if this is is must when he use this adapter.

Copy link
Collaborator Author

@zhaoyuguang zhaoyuguang May 8, 2020

Choose a reason for hiding this comment

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

恩 修复了 之前还奇怪 idea为啥报警告呢
image
稍后 我在其他pr 把其他demo 类似也一起fix了

Comment on lines +33 to +56
public class OkHttpTestController {

@Value("${server.port}")
private Integer port;

@RequestMapping("/okhttp/back")
public String back() {
return "Welcome Back!";
}

@RequestMapping("/okhttp/back/{id}")
public String back(@PathVariable String id) {
return "Welcome Back! " + id;
}

@RequestMapping("/okhttp/testcase/{id}")
public String testcase(@PathVariable String id) throws Exception {
return getRemoteString(id);
}

@RequestMapping("/okhttp/testcase")
public String testcase() throws Exception {
return getRemoteString(null);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about also adding demo for post method?

When I add a post controller for test:

@PostMapping("/okhttp/post")
public String post(HttpServletRequest request) throws Exception {
    byte[] body = StreamUtils.copyToByteArray(request.getInputStream());
    System.out.println(new String(body));
    return "post";
}

@RequestMapping("/okhttp/testcase/post")
public String testcasePost() throws Exception {
    MediaType mediaType = MediaType.parse("application/json; charset=utf-8");
    String requestBody = "{\"name\":\"cdfive\"}";
    OkHttpClient client = new OkHttpClient.Builder()
            .addInterceptor(new SentinelOkHttpInterceptor())
            .build();
    Request request = new Request.Builder()
            .url("http://localhost:" + port + "/okhttp/post")
            .post(RequestBody.create(mediaType, requestBody))
            .build();
    Response response = client.newCall(request).execute();
    return response.body().string();
}

I find the resource name in dashboard are:
http://localhost:8085/okhttp/back
http://localhost:8085/okhttp/post
They have no GET or POST, and also no okhttp: prefix

This is due to the custom extrator in OkHttpDemoApplication class.
My point is whether the interface OkHttpResourceExtractor#extract(Request request, Connection connection)
granularity is too big? When user use their custom extrator, they can't be benefit from or reuse the logic of DefaultOkHttpResourceExtractor, which provide common prefix and method logic.

The UrlCleaner interface in sentinel-web-servlet module can be referred.
UrlCleaner: String clean(String originUrl);
and the CommonFilter append the http method prefix outside the clean method.

Now, the advantage of DefaultOkHttpResourceExtractor is that it allows users to define resources completely when use their custom extrator.
It may need take info consideration compromise in design and decide which is better.
How about your option? @sczyh30 @zhaoyuguang

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

恩 prefix默认是空的,demo中 自定义提取器写的粗暴一点呢

        SentinelOkHttpConfig.setExtractor(new OkHttpResourceExtractor() {
            @Override
            public String extract(Request request, Connection connection) {
                String url = request.url().toString();
                String regex = "/okhttp/back/";
                if (url.contains(regex)) {
                    url = url.substring(0, url.indexOf(regex) + regex.length()) + "{id}";
                }
                return url;
            }
        });

我还是建议给用户开放 竟可能多的参数,issue #1287 反应的就像更高阶的定义资源

Copy link
Collaborator

@cdfive cdfive May 8, 2020

Choose a reason for hiding this comment

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

开放更多的参数没问题,prefix:method:url,只是prefix:method看要不要固定,
比如:
String extract(String target, Request request, Connection connection)
或者 String extract(String url, Request request, Connection connection)
让整个target或者url用户进一步自定义。

个人觉得现在这样也不错,灵活性最大。只是正好想到这个参考下哈~

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

target 和 url 是哪里来的呢?是okhttp-adapter默认提取出来的 然后提供给用户么?

Copy link
Collaborator

@cdfive cdfive May 8, 2020

Choose a reason for hiding this comment

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

@zhaoyuguang 大概想到这2个思路:
1.先用prefix:method:url处理好,假设处理后值为target,
然后通过接口String extract(String target, Request request, Connection connection)让用户进一步自定义处理,默认返回target。

2.先得到url,
然后通过接口String extract(String url, Request request, Connection connection)让用户自定义处理,默认返回url,
最后在前面加上prefix:method:

第1种是整体用前缀处理好,由用户进一步处理;
第2种是用户处理url后,再加前缀;
值得注意的是:两种里面的prefix如果不需要或者要自定义都可以通过(SentinelOkHttpConfig#setPrefix)设置;但method目前暂时不行。
web-servlet模块的CommonFilter就是第2种方式。

上面2种就是有一定的规则约定,在此基础上自定义;
目前的方式是最灵活,如果用户自定义,则整个资源名都自定义。
@sczyh30 宿何空了也看看呢~

Copy link
Member

Choose a reason for hiding this comment

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

这里叫 ResourceExtractor 的原因是不希望给用户“只能将 URL 作为资源名”的印象。建议 prefix 可以放到 extractor 外边,然后 method:URL 这种 就作为默认实现好了,用户有需要 就自定义。

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

使用了 第二种 ResourceExtractor 方法是
String extract(String url, Request request, Connection connection);
url默认是method:URL

Copy link
Member

Choose a reason for hiding this comment

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

传入的 URL 里面就不要带 ${method}: 了,参数就按照 URL 来传入,只不过 default extractor 里面的实现带上这个 method 前缀;另外总的那个 prefix 带到 interceptor 里面来作为总体控制的,如果有配就 append 上来。

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed 抽空 review下

@codecov-io
Copy link

codecov-io commented May 8, 2020

Codecov Report

Merging #1456 into master will increase coverage by 0.12%.
The diff coverage is 66.66%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1456      +/-   ##
============================================
+ Coverage     43.80%   43.92%   +0.12%     
- Complexity     1703     1717      +14     
============================================
  Files           372      376       +4     
  Lines         10605    10661      +56     
  Branches       1414     1418       +4     
============================================
+ Hits           4645     4683      +38     
- Misses         5393     5411      +18     
  Partials        567      567              
Impacted Files Coverage Δ Complexity Δ
...inel/adapter/okhttp/SentinelOkHttpInterceptor.java 50.00% <50.00%> (ø) 2.00 <2.00> (?)
...el/adapter/okhttp/config/SentinelOkHttpConfig.java 68.75% <68.75%> (ø) 5.00 <5.00> (?)
...okhttp/cleaner/DefaultOkHttpResourceExtractor.java 83.33% <83.33%> (ø) 2.00 <2.00> (?)
...adapter/okhttp/fallback/DefaultOkHttpFallback.java 100.00% <100.00%> (ø) 2.00 <2.00> (?)
...dapter/gateway/common/rule/GatewayRuleManager.java 64.88% <0.00%> (-4.47%) 13.00% <0.00%> (ø%)
...inel/slots/block/flow/param/ParamFlowRuleUtil.java 62.63% <0.00%> (+1.09%) 31.00% <0.00%> (+1.00%)
... 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 ba39109...1e3b346. Read the comment docs.

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 removed the to-review To review label May 15, 2020
@sczyh30 sczyh30 merged commit 2b68a6c into alibaba:master May 15, 2020
@sczyh30
Copy link
Member

sczyh30 commented May 15, 2020

Nice work. Thanks for contributing and look forward more!

@zhaoyuguang
Copy link
Collaborator Author

Thanks for @cdfive @sczyh30 patient guidance. too

linlinisme added a commit to linlinisme/Sentinel that referenced this pull request Nov 24, 2020
* 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 <sczyh16@gmail.com>

* Polish code of transport command centers and heartbeat senders

Signed-off-by: Eric Zhao <sczyh16@gmail.com>

* 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 <sczyh16@gmail.com>

* Move CommandCenterLog to sentinel-transport-common and polish related code (alibaba#1341)

Signed-off-by: Eric Zhao <sczyh16@gmail.com>

* Polish placeholders in logging content to slf4j convention (alibaba#1342)

* Polish placeholders in logging content to "{}"

Signed-off-by: Eric Zhao <sczyh16@gmail.com>

* Fix timezone problem of sentinel-block.log

Signed-off-by: Eric Zhao <sczyh16@gmail.com>

* 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 <sczyh16@gmail.com>

* dashboard: Hide advanced options in flow rule dialog when cluster mode is enabled (alibaba#1367)

* doc: Update README.md

Signed-off-by: Eric Zhao <sczyh16@gmail.com>

* Update fastjson to 1.2.68

Signed-off-by: Eric Zhao <sczyh16@gmail.com>

* Bump version to 1.7.2

Signed-off-by: Eric Zhao <sczyh16@gmail.com>

* 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 <sczyh16@gmail.com>

* 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 <sczyh16@gmail.com>

* Refactor the mechanism of recording error in Entry and StatisticSlot

* Also polish related complete callbacks

Signed-off-by: Eric Zhao <sczyh16@gmail.com>

* Polish Tracer with entry.setError(ex) mechanism

Signed-off-by: Eric Zhao <sczyh16@gmail.com>

* 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 <sczyh16@gmail.com>

* 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 <yunfeiyang@buaa.edu.cn>

* 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 <yunfeiyang@buaa.edu.cn>

* 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 <yunfeiyang@buaa.edu.cn>

* 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 <sczyh16@gmail.com>

* 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 <sczyh16@gmail.com>

* 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 <sczyh16@gmail.com>

* 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 <yunfeiyang@buaa.edu.cn>

* 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 <yunfeiyang@buaa.edu.cn>

* 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 <sczyh16@gmail.com>

* test: Add unit test for sentinel-cluster-server and polish code (alibaba#1529)

Signed-off-by: yunfeiyanggzq <yunfeiyang@buaa.edu.cn>

* 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 <sczyh16@gmail.com>

* Update test cases for circuit breaking

Signed-off-by: Eric Zhao <sczyh16@gmail.com>

* Update demo for circuit breaking (DegradeRule)

Signed-off-by: Eric Zhao <sczyh16@gmail.com>

* test: Update test cases with new degrade mechanism in sentinel-demo-quarkus

Signed-off-by: Eric Zhao <sczyh16@gmail.com>

* Remove deprecated passCheck() in Rule and polish interface

Signed-off-by: Eric Zhao <sczyh16@gmail.com>

* Polish cluster flow control demo: add port in Nacos address (alibaba#1655)

Signed-off-by: yunfeiyanggzq <yunfeiyang@buaa.edu.cn>

* Polish boolean checking in test cases and dashboard (alibaba#1664)

* Remove unused code in TokenServerHandler#channelActive (alibaba#1667)

Signed-off-by: cj <power4j@outlook.com>

* 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 <sczyh16@gmail.com>

* 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 <sczyh16@gmail.com>

* 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 <sczyh16@gmail.com>

* 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 <sczyh16@gmail.com>

* 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 <sczyh16@gmail.com>

* 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 <sczyh16@gmail.com>

* 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 <sczyh16@gmail.com>

* 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 <sczyh16@gmail.com>

* Improve compatibility for dispatched servlet request in Spring Web adapter (alibaba#1681)

* Bump version to 1.8.0

Signed-off-by: Eric Zhao <sczyh16@gmail.com>

* Update README.md

Signed-off-by: Eric Zhao <sczyh16@gmail.com>

* Bump version to 1.8.1-SNAPSHOT

Signed-off-by: Eric Zhao <sczyh16@gmail.com>

* Fix typo in CircuitBreakingIntegrationTest (alibaba#1688)

Signed-off-by: yunfeiyanggzq <yunfeiyang@buaa.edu.cn>

* 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 <power4j@outlook.com>

* Add attributes of cluster concurrency limiting in ClusterFlowConfig

Signed-off-by: yunfeiyanggzq <yunfeiyang@buaa.edu.cn>

* Add concurrency token request/release operation in TokenService

Signed-off-by: yunfeiyanggzq <yunfeiyang@buaa.edu.cn>

* Add basic cluster concurrency limiting impl in token server module

Signed-off-by: yunfeiyanggzq <yunfeiyang@buaa.edu.cn>

* Add unit tests for cluster concurrent limiting checker

Signed-off-by: yunfeiyanggzq <yunfeiyang@buaa.edu.cn>

* 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 <hblzxsj@163.com>

* 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 <odidev@puresoftware.com>

* [feat alibaba#1839]: Make dashboard support deploying under subpath (alibaba#1851)

* dashboard: Add statIntervalMs field in DegradeRule dialog (alibaba#1781)

Co-authored-by: tianhao <tianhao@kuaishou.com>
Co-authored-by: jy2156121 <zry11@163.com>
Co-authored-by: Olof <olof.nord@tutanota.com>
Co-authored-by: cdfive <31885791+cdfive@users.noreply.github.com>
Co-authored-by: Jason Joo <hblzxsj@163.com>
Co-authored-by: tao.zhang <waves_Max@163.com>
Co-authored-by: Eric Zhao <sczyh16@gmail.com>
Co-authored-by: WongTheo <61610981+WongTheo@users.noreply.github.com>
Co-authored-by: 于玉桔 <zhaoyuguang@apache.org>
Co-authored-by: Zhiguo.Chen <chenzhiguo@live.com>
Co-authored-by: seasidesky <62706379+seasidesky@users.noreply.github.com>
Co-authored-by: haifeng <haifeng_yang@163.com>
Co-authored-by: johnli <joooohnli@gmail.com>
Co-authored-by: zhenxianyimeng <1920405993@qq.com>
Co-authored-by: pleasecheckhere2016 <707748808@qq.com>
Co-authored-by: ZhiQiang Gu <43897640+yunfeiyanggzq@users.noreply.github.com>
Co-authored-by: zechao zheng <15869103363@163.com>
Co-authored-by: yangy <root@jcod3r.com>
Co-authored-by: xiby <15555438336@163.com>
Co-authored-by: iron_city <55343460+DogBaoBao@users.noreply.github.com>
Co-authored-by: Bo <15528330581@163.com>
Co-authored-by: HupJ <576811031@qq.com>
Co-authored-by: Peine <peineliang@163.com>
Co-authored-by: cj <jclazz@outlook.com>
Co-authored-by: Bill Yip <yezaifei@163.com>
Co-authored-by: liqiangz <liqiang.zjhz@gmail.com>
Co-authored-by: mikawudi <mikawudi@qq.com>
Co-authored-by: dani3lWong <danielw0ng@foxmail.com>
Co-authored-by: cj <power4j@outlook.com>
Co-authored-by: yunfeiyanggzq <yunfeiyang@buaa.edu.cn>
Co-authored-by: Luke <gdjiegz@gmail.com>
Co-authored-by: HelloCoCooo <46306510+HelloCoCooo@users.noreply.github.com>
Co-authored-by: nickChenyx <nickChenyx@gmail.com>
Co-authored-by: Weihua <vip_wangweihua@163.com>
Co-authored-by: 王振广 <wzg923@126.com>
Co-authored-by: Lynx <65679911+xierunzi@users.noreply.github.com>
Co-authored-by: odidev <odidev@puresoftware.com>
Co-authored-by: Brent <xuande@inspur.com>
hughpearse pushed a commit to hughpearse/Sentinel that referenced this pull request Jun 2, 2021
CST11021 pushed a commit to CST11021/Sentinel that referenced this pull request Nov 3, 2021
Add PhysicMsgTimestamp update logic when replicas recovering from the abnormal case.

Closes alibaba#1456
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/integrations Issues or PRs related to integrations with open-source components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add OkHttp integration
4 participants