[GitHub] [servicecomb-kie] hityc2019 closed issue #148: docker compose启动servicecomb-kie报错

2020-07-30 Thread GitBox


hityc2019 closed issue #148:
URL: https://github.com/apache/servicecomb-kie/issues/148


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-kie] hityc2019 commented on issue #148: docker compose启动servicecomb-kie报错

2020-07-30 Thread GitBox


hityc2019 commented on issue #148:
URL: https://github.com/apache/servicecomb-kie/issues/148#issuecomment-666903700


需要更新最新镜像



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-docs] liubao68 opened a new pull request #191: [SCB-2050]add documents for schemaInterface

2020-07-30 Thread GitBox


liubao68 opened a new pull request #191:
URL: https://github.com/apache/servicecomb-docs/pull/191


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] liubao68 merged pull request #1903: [SCB-2053]support define interface or abstract class as model

2020-07-30 Thread GitBox


liubao68 merged pull request #1903:
URL: https://github.com/apache/servicecomb-java-chassis/pull/1903


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[servicecomb-java-chassis] branch master updated: [SCB-2053]support define interface or abstract class as model

2020-07-30 Thread liubao
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git


The following commit(s) were added to refs/heads/master by this push:
 new 823ad39  [SCB-2053]support define interface or abstract class as model
823ad39 is described below

commit 823ad39ded25ac3423909f7dc275e853d7f6b7f4
Author: liubao 
AuthorDate: Thu Jul 30 20:53:57 2020 +0800

[SCB-2053]support define interface or abstract class as model
---
 .../demo/jaxrs/client/SchemeInterfaceJaxrs.java|  4 
 .../demo/jaxrs/client/TestSchemeInterfaceJaxrs.java| 18 ++
 .../demo/jaxrs/server/SchemeInterfaceJaxrs.java|  5 +
 .../demo/jaxrs/server/SchemeInterfaceJaxrsImpl.java|  6 ++
 .../jaxrs-server/src/main/resources/microservice.yaml  |  5 -
 demo/demo-jaxrs/pom.xml|  9 +
 .../swagger/generator/springdata/SpringDataModule.java | 11 +--
 .../springdata/TestPageResponseTypeProcessor.java  | 11 +--
 8 files changed, 60 insertions(+), 9 deletions(-)

diff --git 
a/demo/demo-jaxrs/jaxrs-client/src/main/java/org/apache/servicecomb/demo/jaxrs/client/SchemeInterfaceJaxrs.java
 
b/demo/demo-jaxrs/jaxrs-client/src/main/java/org/apache/servicecomb/demo/jaxrs/client/SchemeInterfaceJaxrs.java
index 53f4c07..a074ad9 100644
--- 
a/demo/demo-jaxrs/jaxrs-client/src/main/java/org/apache/servicecomb/demo/jaxrs/client/SchemeInterfaceJaxrs.java
+++ 
b/demo/demo-jaxrs/jaxrs-client/src/main/java/org/apache/servicecomb/demo/jaxrs/client/SchemeInterfaceJaxrs.java
@@ -17,8 +17,12 @@
 
 package org.apache.servicecomb.demo.jaxrs.client;
 
+import org.springframework.data.domain.Page;
+
 public interface SchemeInterfaceJaxrs {
   int add(int a, int b);
 
   int reduce(int a, int b);
+
+  Page interfaceModel(Page model);
 }
diff --git 
a/demo/demo-jaxrs/jaxrs-client/src/main/java/org/apache/servicecomb/demo/jaxrs/client/TestSchemeInterfaceJaxrs.java
 
b/demo/demo-jaxrs/jaxrs-client/src/main/java/org/apache/servicecomb/demo/jaxrs/client/TestSchemeInterfaceJaxrs.java
index 6ebc4ef..6ba8d17 100644
--- 
a/demo/demo-jaxrs/jaxrs-client/src/main/java/org/apache/servicecomb/demo/jaxrs/client/TestSchemeInterfaceJaxrs.java
+++ 
b/demo/demo-jaxrs/jaxrs-client/src/main/java/org/apache/servicecomb/demo/jaxrs/client/TestSchemeInterfaceJaxrs.java
@@ -17,9 +17,17 @@
 
 package org.apache.servicecomb.demo.jaxrs.client;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.servicecomb.demo.CategorizedTestCase;
 import org.apache.servicecomb.demo.TestMgr;
 import org.apache.servicecomb.provider.pojo.RpcReference;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageImpl;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.domain.Sort;
 import org.springframework.stereotype.Component;
 
 @Component
@@ -27,6 +35,16 @@ public class TestSchemeInterfaceJaxrs implements 
CategorizedTestCase {
   @RpcReference(schemaId = "SchemeInterfaceJaxrs", microserviceName = "jaxrs")
   private SchemeInterfaceJaxrs jaxrs;
 
+  public void testRestTransport() throws Exception {
+List contents = new ArrayList<>();
+contents.add("hello");
+Sort sort = Sort.by(new String[0]);
+Pageable pageable = PageRequest.of(1, 10, sort);
+Page pages = new PageImpl<>(contents, pageable, 1);
+Page result = jaxrs.interfaceModel(pages);
+TestMgr.check("hello", result.stream().findFirst().get());
+  }
+
   public void testAllTransport() throws Exception {
 TestMgr.check(3, jaxrs.add(1, 2));
 
diff --git 
a/demo/demo-jaxrs/jaxrs-server/src/main/java/org/apache/servicecomb/demo/jaxrs/server/SchemeInterfaceJaxrs.java
 
b/demo/demo-jaxrs/jaxrs-server/src/main/java/org/apache/servicecomb/demo/jaxrs/server/SchemeInterfaceJaxrs.java
index e0de028..bd9f07c 100644
--- 
a/demo/demo-jaxrs/jaxrs-server/src/main/java/org/apache/servicecomb/demo/jaxrs/server/SchemeInterfaceJaxrs.java
+++ 
b/demo/demo-jaxrs/jaxrs-server/src/main/java/org/apache/servicecomb/demo/jaxrs/server/SchemeInterfaceJaxrs.java
@@ -23,6 +23,7 @@ import javax.ws.rs.Path;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
 
+import org.springframework.data.domain.Page;
 import org.springframework.web.bind.annotation.RequestParam;
 
 @Path("/jaxrs/schemaInterface")
@@ -31,4 +32,8 @@ public interface SchemeInterfaceJaxrs {
   @Path("/add")
   @GET
   public int add(@Min(1) @RequestParam("a") int a, @Min(1) @RequestParam("b") 
int b);
+
+  @Path("/interfaceModel")
+  @GET
+  Page interfaceModel(Page model);
 }
diff --git 
a/demo/demo-jaxrs/jaxrs-server/src/main/java/org/apache/servicecomb/demo/jaxrs/server/SchemeInterfaceJaxrsImpl.java
 
b/demo/demo-jaxrs/jaxrs-server/src/main/java/org/apache/servicecomb/demo/jaxrs/server/SchemeInterfaceJaxrsImpl.java
index 

[servicecomb-docs] branch master updated: [SCB-2054] update documents for data types and extension support. add upgrade guide

2020-07-30 Thread liubao
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-docs.git


The following commit(s) were added to refs/heads/master by this push:
 new 9848692  [SCB-2054] update documents for data types and extension 
support. add upgrade guide
9848692 is described below

commit 9848692b847d622ee9e436a92bd4aaae0c1a572f
Author: liubao 
AuthorDate: Fri Jul 31 10:28:11 2020 +0800

[SCB-2054] update documents for data types and extension support. add 
upgrade guide
---
 .../docs/build-provider/interface-constraints.md   | 277 -
 .../zh_CN/docs/featured-topics/upgrading.md|   3 +-
 .../docs/featured-topics/upgrading/2_1_0T2_1_1.md  |  16 ++
 3 files changed, 229 insertions(+), 67 deletions(-)

diff --git 
a/java-chassis-reference/zh_CN/docs/build-provider/interface-constraints.md 
b/java-chassis-reference/zh_CN/docs/build-provider/interface-constraints.md
index 7e6c119..c83f4e3 100644
--- a/java-chassis-reference/zh_CN/docs/build-provider/interface-constraints.md
+++ b/java-chassis-reference/zh_CN/docs/build-provider/interface-constraints.md
@@ -1,68 +1,108 @@
 # 接口定义和数据类型
 
-## 接口定义的要求
-
-ServiceComb-Java-Chassis建议接口定义遵循一个简单的原则:接口定义即接口使用说明,不用通过查看代码实现,就能识别如何调用这个接口。可以看出,这个原则站在使用者这边,以更容易被使用作为参考。ServiceComb会根据接口定义生成接口契约,符合这个原则的接口,生成的契约也是用户容易阅读的。
-
-举个例子:
-
-```java
-public Person query(String id);
-public Object query(String id);
-public Person query(String name);
-```
-
-显然调用接口一,我们知道要传递一个String类型的id参数,返回值是一个Person类型,Person里面存在String类型的name参数。调用接口二,我们不知道怎么处理返回值,必须参考服务提供者的文档说明。这个视角是熟练的RPC开发者的视角。
-
-当我们要将接口发布为REST接口的时候,可以指定接口参数和HTTP协议的映射关系,比如:
-
-```java
-public Person query(@RequestParam String id);
-public Person query(@PathVariable String id);
-public void save(@RequestBody Person person);
-```
-
-通常,我们会将简单的数据类型,比如String, 
int等在RequestParam或者PathVariable传递,而把复杂的数据类型使用JSON编码以后在RequestBody传递,以减少HTTP协议限制可能给开发者带来的各种问题。这个视角是熟练的REST开发者的视角,在RPC开发者的视角之外,REST开发者需要理解的信息更多,他们不仅需要知道RPC接口,还需要了解接口和HTTP协议的绑定关系,要理解JAVA对象如何在HTTP的消息中进行转换。
-
-ServiceComb-Java-Chassis还有一个约束:接口定义必须符合Open 
API的规范,从而能够更好的在不同语言之间进行协作,能够支持除了HTTP以为的其他协议和编码。熟练的SpringMVC、JAX-RS开发者会发现一些特殊的用法无法使用,比如使用HttpServletRequest来解析HTTP头信息等。再比如,按照Open
 
API规范,每个接口都必须有唯一的ID,如果开发者需要使用重载,那么必须显示的使用@ApiOperation给重载方法赋予唯一的ID。ServiceComb-Java-Chassis接口定义要求符合下面的范式:
-
-```
-@SupportedAnnotations
-ResponseType methodName(RequestType...)
-```
-
-不能定义异常、不能包含在接口原型未声明的错误码和输出(如果没声明错误码,缺省的错误码除外,比如HTTP 的200)。
-
-通常,系统约束越多,那么就更加容易对系统进行统一的管控和治理;开发方式越自由,实现业务功能则更加快速,需要在这两方面取得一些平衡。ServiceComb-Java-Chassis是比gRPC要灵活很多的框架,同时也去掉了Spring
 
MVC的一些不常用的扩展。开发者可以在ServiceComb-Java-Chassis讨论区反馈开发过程中期望支持的场景,更好的维护这个平衡。期望这个讨论是围绕某个具体的应用场景来进行的,比如上传文件如何更好的进行,而不是具体的开发方式进行的,比如使用Object来传递参数。
-
-## 详细的约束列表
+不论采用 `JAX-RS`、`Spring MVC`,还是采用 `透明RPC` 开发,都涉及接口的返回值和参数。java-chassis 
+采用的是一种平台无关的数据序列化方式,当 `Transport` 为 `REST` 的时候,序列化方式为 `json`,当
+`Transport` 为 `Highway` 的时候,序列化方式为 `protobuffer`。 平台无关的数据序列化方式有个基本
+特征:作为 `Consumer`, 从序列化的数据中,无法获取任何和 `Consuemr` 开发语言有关的类型信息。 平台无关
+特性给接口定义的数据类型提供了更严格的要求,符合这些要求的接口定义,一方面运行更加高效,另外一方面更加方便的
+动态调整 `Transport`, 而无需对代码做出修改。 
+
+对于 `REST`, 虽然 `json` 本身不包含特定平台的类型信息,但是 `JAVA` 可以通过在反序列化的时候,指定目标
+类型,所以对于 `REST`, 可以更加灵活的使用不同的类型。 
+
+本章节主要介绍为了实现最大的夸平台和高性能,开发者定义接口的最佳实践。同时介绍在使用 `REST` 的情况下,如何
+更加灵活的支持不同的类型。 
+
+## 接口定义的最佳实践和类型约束
+
+java-chassis 的所有接口定义,都可以生成符合 `OpenAPI` 的 `swagger` 接口描述,当使用 `Highway` 协议时,
+`swagger` 文件还会在内部被转换为等价的 `proto` 文件。 接口定义的最佳实践需要满足 `OpenAPI` 和 `proto`的
+数据类型要求。 
+
+* `OpenAPI` 定义了如下一些基本类型:
+
+下面列举一些常见的类型说明,详细参考 [OpenAPI文档][openAPI]。
+
+[OpenAPI]: https://swagger.io/docs/specification/data-models/data-types/
+
+| type | format | java | 说明 |
+| :--- | :--- | :--- | :--- |
+| string | - | String | |
+| string | date | java.util.Date, java.time.LocalDate| 推荐使用 LocalDate|
+| string | date-time | java.util.Date, java.time.LocalDateTime| 推荐使用 
LocalDateTime|
+| number | - | double | |
+| number | float | float | |
+| number | double | double | |
+| integer | - | integer | |
+| integer | int32 | int | |
+| integer | int64 | long | |
+| boolean | - | boolean | |
+| array | | ArrayList | 必须指定类型 |
+| object | | | 由上面的属性构成的对象类型。包括字典(HashMap),字典的 key 必须为 string |
+
+* `proto` 定义了如下一些基本类型:
+
+下面列举一些常见的类型说明,详细参考 [Proto Buffer类型说明][proto-buffer]。
+
+[proto-buffer]: 
https://docs.microsoft.com/en-us/dotnet/architecture/grpc-for-wcf-developers/protobuf-data-types
+
+| type | java | 说明 |
+| :--- | :--- | :--- |
+| double | double | |
+| float | float | |
+| int32 | int | |
+| int64 | long | |
+| uint32 | int | |
+| uint64 | long | |
+| sint32 | int | |
+| sint64 | long | |
+| fixed32 | int | |
+| fixed64 | long | |
+| sfixed32 | int | |
+| sfixed64 | long | |
+| bool | boolean | |
+| string | String | |
+| bytes | ByteString | |
+| map | | 字典类型 |
+
+`OpenAPI` 的 `date` format 在 `proto` 里面采用 `long` 表示。 java-chassis 的开发实践分为 `code 
first`
+和 `contrast first` 两种模式, 如果采用 `contrast first` 模式,先写 `swagger`, 然后通过 `swagger` 
生成
+代码, 这种方式生成的数据类型都是符合最佳实践的。 

[GitHub] [servicecomb-docs] liubao68 merged pull request #190: [SCB-2054] update documents for data types and extension support. add…

2020-07-30 Thread GitBox


liubao68 merged pull request #190:
URL: https://github.com/apache/servicecomb-docs/pull/190


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-docs] liubao68 opened a new pull request #190: [SCB-2054] update documents for data types and extension support. add…

2020-07-30 Thread GitBox


liubao68 opened a new pull request #190:
URL: https://github.com/apache/servicecomb-docs/pull/190


   … upgrade guide



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] coveralls commented on pull request #1903: [SCB-2053]support define interface or abstract class as model

2020-07-30 Thread GitBox


coveralls commented on pull request #1903:
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1903#issuecomment-666402446


   
   [![Coverage 
Status](https://coveralls.io/builds/32429500/badge)](https://coveralls.io/builds/32429500)
   
   Coverage decreased (-0.01%) to 86.318% when pulling 
**7f254753f39a757a10f5ef065c7a45c19f1e728a on liubao68:liubao** into 
**5a780aeca1a99b3cfd999d5443d6e69f0ea25b52 on apache:master**.
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] liubao68 commented on pull request #1903: [SCB-2053]support define interface or abstract class as model

2020-07-30 Thread GitBox


liubao68 commented on pull request #1903:
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1903#issuecomment-666349933


   This feature has already supported. Just update spring data error and add 
test cases. 



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] liubao68 opened a new pull request #1903: [SCB-2053]support define interface or abstract class as model

2020-07-30 Thread GitBox


liubao68 opened a new pull request #1903:
URL: https://github.com/apache/servicecomb-java-chassis/pull/1903


   Follow this checklist to help us incorporate your contribution quickly and 
easily:
   
- [ ] Make sure there is a [JIRA 
issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually 
before you start working on it).  Trivial changes like typos do not require a 
JIRA issue.  Your pull request should address just this issue, without pulling 
in other changes.
- [ ] Each commit in the pull request should have a meaningful subject line 
and body.
- [ ] Format the pull request title like `[SCB-XXX] Fixes bug in 
ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA 
issue.
- [ ] Write a pull request description that is detailed enough to 
understand what the pull request does, how, and why.
- [ ] Run `mvn clean install -Pit` to make sure basic checks pass. A more 
thorough check will be performed on your pull request automatically.
- [ ] If this contribution is large, please file an Apache [Individual 
Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   ---
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] yhs0092 opened a new issue #1902: SpringMVC开发风格下,2.x版本的Java-Chassis不再支持传输非文件类型的form参数了

2020-07-30 Thread GitBox


yhs0092 opened a new issue #1902:
URL: https://github.com/apache/servicecomb-java-chassis/issues/1902


   ```java
 @PostMapping(path = "/hello/form", consumes = 
MediaType.MULTIPART_FORM_DATA_VALUE)
 public String form(@RequestPart(name = "file", required = false) 
MultipartFile file,
 @RequestPart(value = "val") String val) throws IOException {
   LOGGER.info("file content = {}, val = {}",
   Objects.isNull(file) ? file : new String(file.getBytes()),
   val);
   return val;
 }
   ```
   假设定义如上REST接口,1.x版本的 Java-Chassis 生成的契约中会标识 file 参数的类型是 `file` ,而 val 参数的类型是 
`string` 。而使用2.x版本的 Java-Chassis 框架, file 参数和 val 参数在契约中的类型都是 `file` 。这导致 val 
参数无法获取到值,传入业务代码的一直都是 `null` 。
   
   问题的根因在 
`org.apache.servicecomb.swagger.generator.springmvc.processor.annotation.RequestPartAnnotationProcessor#fillParameter`
 方法中, 2.x版本的 Java-Chassis 在这里没有对REST接口类方法参数的类型进行判断,直接将 formParameter 的 property 
设置为 FileProperty 类型了,导致生成的契约中 form 参数的类型一直是 `file` 。



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[servicecomb-java-chassis] branch master updated (7a27c59 -> 5a780ae)

2020-07-30 Thread liubao
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git.


from 7a27c59  [SCB-2052] fix get connection time is 0 when get connection 
timeout
 new 7ec9000  [SCB-2043] flow control bug fix
 new e414f57  [SCB-2043] flow control support custom
 new 84eb8be  [SCB-2043] refactory as comment
 new 5a780ae  [SCB-2043] add IT

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../demo/springmvc/server/MyStrategy.java  | 17 +
 ...SpringmvcServer.java => MyStrategyFactory.java} | 16 +
 ...pache.servicecomb.qps.strategy.IStrategyFactory |  2 +-
 .../src/main/resources/microservice.yaml   | 10 +-
 .../servicecomb/qps/QpsControllerManager.java  | 41 --
 .../org/apache/servicecomb/qps/QpsStrategy.java|  2 ++
 .../qps/strategy/AbstractQpsStrategy.java  | 14 +++-
 ...rategyType.java => DefaultStrategyFactory.java} | 29 ++-
 .../qps/strategy/FixedWindowStrategy.java  | 10 +++---
 .../servicecomb/qps/strategy/IStrategyFactory.java |  6 ++--
 .../qps/strategy/LeakyBucketStrategy.java  | 14 +++-
 .../qps/strategy/TokenBucketStrategy.java  |  7 ++--
 ...pache.servicecomb.qps.strategy.IStrategyFactory |  2 +-
 .../qps/TestConsumerQpsFlowControlHandler.java | 12 +--
 .../qps/TestProviderQpsFlowControlHandler.java | 14 ++--
 .../apache/servicecomb/qps/TestQpsStrategy.java|  8 +++--
 16 files changed, 115 insertions(+), 89 deletions(-)
 copy 
service-registry/registry-service-center/src/test/java/org/apache/servicecomb/serviceregistry/adapter/CasEnvAdapterThree.java
 => 
demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/MyStrategy.java
 (76%)
 copy 
demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/{SpringmvcServer.java
 => MyStrategyFactory.java} (70%)
 copy 
common/common-access-log/src/main/resources/META-INF/services/org.apache.servicecomb.core.BootListener
 => 
demo/demo-springmvc/springmvc-server/src/main/resources/META-INF/services/org.apache.servicecomb.qps.strategy.IStrategyFactory
 (92%)
 rename 
handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/strategy/{StrategyType.java
 => DefaultStrategyFactory.java} (66%)
 copy 
foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/config/ConfigLoader.java
 => 
handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/strategy/IStrategyFactory.java
 (85%)
 copy 
core/src/main/resources/META-INF/services/org.apache.servicecomb.core.tracing.TraceIdGenerator
 => 
handlers/handler-flowcontrol-qps/src/main/resources/META-INF/services/org.apache.servicecomb.qps.strategy.IStrategyFactory
 (93%)



[servicecomb-java-chassis] 04/04: [SCB-2043] add IT

2020-07-30 Thread liubao
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git

commit 5a780aeca1a99b3cfd999d5443d6e69f0ea25b52
Author: GuoYL 
AuthorDate: Thu Jul 30 16:29:25 2020 +0800

[SCB-2043] add IT
---
 .../demo/springmvc/server/MyStrategy.java  | 33 ++
 .../demo/springmvc/server/MyStrategyFactory.java   | 32 +
 ...pache.servicecomb.qps.strategy.IStrategyFactory | 18 
 .../src/main/resources/microservice.yaml   | 10 ++-
 4 files changed, 92 insertions(+), 1 deletion(-)

diff --git 
a/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/MyStrategy.java
 
b/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/MyStrategy.java
new file mode 100644
index 000..1f65448
--- /dev/null
+++ 
b/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/MyStrategy.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.demo.springmvc.server;
+
+import org.apache.servicecomb.qps.strategy.AbstractQpsStrategy;
+
+public class MyStrategy extends AbstractQpsStrategy {
+
+  @Override
+  public boolean isLimitNewRequest() {
+return false;
+  }
+
+  @Override
+  public String name() {
+return "MyStrategy";
+  }
+}
diff --git 
a/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/MyStrategyFactory.java
 
b/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/MyStrategyFactory.java
new file mode 100644
index 000..002aa95
--- /dev/null
+++ 
b/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/MyStrategyFactory.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.demo.springmvc.server;
+
+import org.apache.servicecomb.qps.strategy.AbstractQpsStrategy;
+import org.apache.servicecomb.qps.strategy.IStrategyFactory;
+
+public class MyStrategyFactory implements IStrategyFactory {
+
+  @Override
+  public AbstractQpsStrategy createStrategy(String strategyName) {
+if (strategyName.equals("MyStrategy")) {
+  return new MyStrategy();
+}
+return null;
+  }
+}
diff --git 
a/demo/demo-springmvc/springmvc-server/src/main/resources/META-INF/services/org.apache.servicecomb.qps.strategy.IStrategyFactory
 
b/demo/demo-springmvc/springmvc-server/src/main/resources/META-INF/services/org.apache.servicecomb.qps.strategy.IStrategyFactory
new file mode 100644
index 000..f1941ba
--- /dev/null
+++ 
b/demo/demo-springmvc/springmvc-server/src/main/resources/META-INF/services/org.apache.servicecomb.qps.strategy.IStrategyFactory
@@ -0,0 +1,18 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, 

[GitHub] [servicecomb-java-chassis] liubao68 merged pull request #1894: [SCB-2043] flow control support custom / bug fix

2020-07-30 Thread GitBox


liubao68 merged pull request #1894:
URL: https://github.com/apache/servicecomb-java-chassis/pull/1894


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[servicecomb-java-chassis] 03/04: [SCB-2043] refactory as comment

2020-07-30 Thread liubao
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git

commit 84eb8bebfed0547e5b971af9f46c864598b12273
Author: GuoYL 
AuthorDate: Tue Jul 28 17:26:06 2020 +0800

[SCB-2043] refactory as comment
---
 .../servicecomb/qps/QpsControllerManager.java  | 45 +++---
 .../org/apache/servicecomb/qps/QpsStrategy.java|  2 +
 .../qps/strategy/AbstractQpsStrategy.java  | 14 +++
 ...rategyType.java => DefaultStrategyFactory.java} | 30 ++-
 .../qps/strategy/FixedWindowStrategy.java  | 10 +++--
 .../IStrategyFactory.java} |  6 +--
 .../qps/strategy/LeakyBucketStrategy.java  | 14 +++
 .../qps/strategy/TokenBucketStrategy.java  |  7 +++-
 ...pache.servicecomb.qps.strategy.IStrategyFactory | 18 +
 .../qps/TestConsumerQpsFlowControlHandler.java | 12 --
 .../qps/TestProviderQpsFlowControlHandler.java | 14 +--
 .../apache/servicecomb/qps/TestQpsStrategy.java|  8 +++-
 12 files changed, 103 insertions(+), 77 deletions(-)

diff --git 
a/handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/QpsControllerManager.java
 
b/handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/QpsControllerManager.java
index 606b642..a287ca2 100644
--- 
a/handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/QpsControllerManager.java
+++ 
b/handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/QpsControllerManager.java
@@ -17,21 +17,21 @@
 
 package org.apache.servicecomb.qps;
 
+import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 
 import org.apache.servicecomb.core.Invocation;
 import org.apache.servicecomb.foundation.common.concurrent.ConcurrentHashMapEx;
+import 
org.apache.servicecomb.foundation.common.exceptions.ServiceCombException;
 import org.apache.servicecomb.foundation.common.utils.SPIServiceUtils;
 import org.apache.servicecomb.qps.strategy.AbstractQpsStrategy;
-import org.apache.servicecomb.qps.strategy.FixedWindowStrategy;
-import org.apache.servicecomb.qps.strategy.LeakyBucketStrategy;
-import org.apache.servicecomb.qps.strategy.StrategyType;
-import org.apache.servicecomb.qps.strategy.TokenBucketStrategy;
+import org.apache.servicecomb.qps.strategy.IStrategyFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import com.netflix.config.DynamicProperty;
+import org.apache.commons.lang3.StringUtils;
 
 public class QpsControllerManager {
   private static final Logger LOGGER = 
LoggerFactory.getLogger(QpsControllerManager.class);
@@ -210,27 +210,26 @@ public class QpsControllerManager {
   }
 
   private AbstractQpsStrategy chooseStrategy(String globalConfigKey, Long 
limit, Long bucket,
-  String strategyKey) {
-AbstractQpsStrategy strategy;
-AbstractQpsStrategy customStrategy = SPIServiceUtils
-.getTargetService(AbstractQpsStrategy.class);
-switch (StrategyType.parseStrategyType(strategyKey)) {
-  case FixedWindow:
-strategy = new FixedWindowStrategy(globalConfigKey, limit);
-break;
-  case LeakyBucket:
-strategy = new LeakyBucketStrategy(globalConfigKey, limit);
-break;
-  case TokenBucket:
-strategy = new TokenBucketStrategy(globalConfigKey, limit, bucket);
-break;
-  case Custom:
-strategy = customStrategy;
+  String strategyName) {
+if (StringUtils.isEmpty(strategyName)) {
+  strategyName = "FixedWindow";
+}
+AbstractQpsStrategy strategy = null;
+List strategyFactories = SPIServiceUtils
+.getOrLoadSortedService(IStrategyFactory.class);
+for (IStrategyFactory strategyFactory : strategyFactories) {
+  strategy = strategyFactory.createStrategy(strategyName);
+  if (strategy != null) {
 break;
-  case SlidingWindow:
-  default:
-strategy = new FixedWindowStrategy(globalConfigKey, limit);
+  }
+}
+if (strategy == null) {
+  throw new ServiceCombException(
+  "the qps strategy name " + strategyName + " is not exist , please 
check.");
 }
+strategy.setKey(globalConfigKey);
+strategy.setQpsLimit(limit);
+strategy.setBucketLimit(bucket);
 return strategy;
   }
 
diff --git 
a/handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/QpsStrategy.java
 
b/handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/QpsStrategy.java
index 606d7b8..8a712e3 100644
--- 
a/handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/QpsStrategy.java
+++ 
b/handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/QpsStrategy.java
@@ -20,4 +20,6 @@ package org.apache.servicecomb.qps;
 public interface QpsStrategy {
 
   boolean isLimitNewRequest();
+
+  String name();
 }
diff --git 

[servicecomb-java-chassis] 02/04: [SCB-2043] flow control support custom

2020-07-30 Thread liubao
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git

commit e414f5709efa4f6b0e464a62aab8235d26c94d8f
Author: GuoYL 
AuthorDate: Mon Jul 27 19:34:44 2020 +0800

[SCB-2043] flow control support custom
---
 .../main/java/org/apache/servicecomb/qps/QpsControllerManager.java  | 6 ++
 .../main/java/org/apache/servicecomb/qps/strategy/StrategyType.java | 3 ++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git 
a/handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/QpsControllerManager.java
 
b/handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/QpsControllerManager.java
index 40e25c5..606b642 100644
--- 
a/handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/QpsControllerManager.java
+++ 
b/handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/QpsControllerManager.java
@@ -22,6 +22,7 @@ import java.util.Map.Entry;
 
 import org.apache.servicecomb.core.Invocation;
 import org.apache.servicecomb.foundation.common.concurrent.ConcurrentHashMapEx;
+import org.apache.servicecomb.foundation.common.utils.SPIServiceUtils;
 import org.apache.servicecomb.qps.strategy.AbstractQpsStrategy;
 import org.apache.servicecomb.qps.strategy.FixedWindowStrategy;
 import org.apache.servicecomb.qps.strategy.LeakyBucketStrategy;
@@ -211,6 +212,8 @@ public class QpsControllerManager {
   private AbstractQpsStrategy chooseStrategy(String globalConfigKey, Long 
limit, Long bucket,
   String strategyKey) {
 AbstractQpsStrategy strategy;
+AbstractQpsStrategy customStrategy = SPIServiceUtils
+.getTargetService(AbstractQpsStrategy.class);
 switch (StrategyType.parseStrategyType(strategyKey)) {
   case FixedWindow:
 strategy = new FixedWindowStrategy(globalConfigKey, limit);
@@ -221,6 +224,9 @@ public class QpsControllerManager {
   case TokenBucket:
 strategy = new TokenBucketStrategy(globalConfigKey, limit, bucket);
 break;
+  case Custom:
+strategy = customStrategy;
+break;
   case SlidingWindow:
   default:
 strategy = new FixedWindowStrategy(globalConfigKey, limit);
diff --git 
a/handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/strategy/StrategyType.java
 
b/handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/strategy/StrategyType.java
index 98d3764..7412b0a 100644
--- 
a/handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/strategy/StrategyType.java
+++ 
b/handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/strategy/StrategyType.java
@@ -23,7 +23,8 @@ public enum StrategyType {
   TokenBucket,
   LeakyBucket,
   FixedWindow,
-  SlidingWindow;
+  SlidingWindow,
+  Custom;
 
 
   public static StrategyType parseStrategyType(String type) {



[servicecomb-java-chassis] 01/04: [SCB-2043] flow control bug fix

2020-07-30 Thread liubao
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git

commit 7ec9000203e2791cbc48f0ce901fb670e38ba909
Author: GuoYL 
AuthorDate: Mon Jul 27 16:16:25 2020 +0800

[SCB-2043] flow control bug fix

(cherry picked from commit eed0e46cf448b0caab1b7211f9780bbd82f55a6b)
---
 .../src/main/java/org/apache/servicecomb/qps/strategy/StrategyType.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/strategy/StrategyType.java
 
b/handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/strategy/StrategyType.java
index 5a9192a..98d3764 100644
--- 
a/handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/strategy/StrategyType.java
+++ 
b/handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/strategy/StrategyType.java
@@ -32,7 +32,7 @@ public enum StrategyType {
 }
 
 try {
-  return StrategyType.valueOf(type.toUpperCase());
+  return StrategyType.valueOf(type);
 } catch (IllegalArgumentException e) {
   return StrategyType.FixedWindow;
 }



[servicecomb-java-chassis] branch master updated: [SCB-2052] fix get connection time is 0 when get connection timeout

2020-07-30 Thread liubao
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git


The following commit(s) were added to refs/heads/master by this push:
 new 7a27c59  [SCB-2052] fix get connection time is 0 when get connection 
timeout
7a27c59 is described below

commit 7a27c595e545ff75c213e752c6811ba6c26b352d
Author: wujimin 
AuthorDate: Thu Jul 30 17:19:44 2020 +0800

[SCB-2052] fix get connection time is 0 when get connection timeout
---
 .../foundation/vertx/metrics/metric/DefaultHttpSocketMetric.java| 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/metrics/metric/DefaultHttpSocketMetric.java
 
b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/metrics/metric/DefaultHttpSocketMetric.java
index 6d98512..dfc5a5f 100644
--- 
a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/metrics/metric/DefaultHttpSocketMetric.java
+++ 
b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/metrics/metric/DefaultHttpSocketMetric.java
@@ -16,6 +16,8 @@
  */
 package org.apache.servicecomb.foundation.vertx.metrics.metric;
 
+// if can not get connection from connection pool
+// then both requestBeginTime and requestEndTime will be 0
 public class DefaultHttpSocketMetric extends DefaultTcpSocketMetric {
   private long requestBeginTime;
 
@@ -29,7 +31,7 @@ public class DefaultHttpSocketMetric extends 
DefaultTcpSocketMetric {
   }
 
   public long getRequestBeginTime() {
-return requestBeginTime;
+return requestBeginTime != 0 ? requestBeginTime : System.nanoTime();
   }
 
   public void requestBegin() {
@@ -37,7 +39,7 @@ public class DefaultHttpSocketMetric extends 
DefaultTcpSocketMetric {
   }
 
   public long getRequestEndTime() {
-return requestEndTime;
+return requestEndTime != 0 ? requestEndTime : System.nanoTime();
   }
 
   public void requestEnd() {



[GitHub] [servicecomb-java-chassis] liubao68 merged pull request #1901: [SCB-2052] fix get connection time is 0 when get connection timeout

2020-07-30 Thread GitBox


liubao68 merged pull request #1901:
URL: https://github.com/apache/servicecomb-java-chassis/pull/1901


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] coveralls edited a comment on pull request #1894: [SCB-2043] flow control support custom / bug fix

2020-07-30 Thread GitBox


coveralls edited a comment on pull request #1894:
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1894#issuecomment-664256329


   
   [![Coverage 
Status](https://coveralls.io/builds/32424620/badge)](https://coveralls.io/builds/32424620)
   
   Coverage increased (+0.03%) to 86.333% when pulling 
**3d9373dd00f21c318f77fb72d7fd77641ed2ed9b on GuoYL123:master** into 
**10381beef0ad6689612cea58c0e42ee51dafaf5b on apache:master**.
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] coveralls edited a comment on pull request #1894: [SCB-2043] flow control support custom / bug fix

2020-07-30 Thread GitBox


coveralls edited a comment on pull request #1894:
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1894#issuecomment-664256329


   
   [![Coverage 
Status](https://coveralls.io/builds/32424250/badge)](https://coveralls.io/builds/32424250)
   
   Coverage increased (+0.02%) to 86.317% when pulling 
**3d9373dd00f21c318f77fb72d7fd77641ed2ed9b on GuoYL123:master** into 
**10381beef0ad6689612cea58c0e42ee51dafaf5b on apache:master**.
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] coveralls edited a comment on pull request #1901: [SCB-2052] fix get connection time is 0 when get connection timeout

2020-07-30 Thread GitBox


coveralls edited a comment on pull request #1901:
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1901#issuecomment-666298522


   
   [![Coverage 
Status](https://coveralls.io/builds/32424241/badge)](https://coveralls.io/builds/32424241)
   
   Coverage remained the same at 86.298% when pulling 
**b37fd8ad8f087557e73ecfc1bb97ec997f36a0c8 on 
wujimin:SCB-2052-fix-metrics-get-connection-time** into 
**10381beef0ad6689612cea58c0e42ee51dafaf5b on apache:master**.
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] coveralls commented on pull request #1901: [SCB-2052] fix get connection time is 0 when get connection timeout

2020-07-30 Thread GitBox


coveralls commented on pull request #1901:
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1901#issuecomment-666298522


   
   [![Coverage 
Status](https://coveralls.io/builds/32424203/badge)](https://coveralls.io/builds/32424203)
   
   Coverage increased (+0.01%) to 86.312% when pulling 
**b37fd8ad8f087557e73ecfc1bb97ec997f36a0c8 on 
wujimin:SCB-2052-fix-metrics-get-connection-time** into 
**10381beef0ad6689612cea58c0e42ee51dafaf5b on apache:master**.
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-pack] wangxudong6451 opened a new issue #677: 0.4.0版本在istio环境下grpc通信异常

2020-07-30 Thread GitBox


wangxudong6451 opened a new issue #677:
URL: https://github.com/apache/servicecomb-pack/issues/677


   
![image](https://user-images.githubusercontent.com/53718510/88906374-f4584700-d289-11ea-849c-68f2418be086.png)
   alpha server能正常收到请求,但客户端好像收不到ACK



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] wujimin opened a new pull request #1901: [SCB-2052] fix get connection time is 0 when can get connection timeout

2020-07-30 Thread GitBox


wujimin opened a new pull request #1901:
URL: https://github.com/apache/servicecomb-java-chassis/pull/1901


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] wujimin merged pull request #1898: [SCB-2046]support customize RestProducers and RpcProducers

2020-07-30 Thread GitBox


wujimin merged pull request #1898:
URL: https://github.com/apache/servicecomb-java-chassis/pull/1898


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[servicecomb-java-chassis] branch master updated (531e121 -> 10381be)

2020-07-30 Thread wujimin
This is an automated email from the ASF dual-hosted git repository.

wujimin pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git.


from 531e121  [SCB-2049]fix trace id logger do not print error message in 
codes
 add 10381be  [SCB-2046]support customize RestProducers and RpcProducers

No new revisions were added by this update.

Summary of changes:
 .../demo/pojo/server/PojoProducersCustomized.java}  | 13 ++---
 .../demo/springmvc/server/RestProducersCutomized.java}  | 13 ++---
 2 files changed, 12 insertions(+), 14 deletions(-)
 copy 
demo/{demo-crossapp/crossapp-server/src/main/java/org/apache/servicecomb/demo/crossapp/CrossappBootListener.java
 => 
demo-pojo/pojo-server/src/main/java/org/apache/servicecomb/demo/pojo/server/PojoProducersCustomized.java}
 (72%)
 copy 
demo/{demo-crossapp/crossapp-server/src/main/java/org/apache/servicecomb/demo/crossapp/CrossappBootListener.java
 => 
demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/RestProducersCutomized.java}
 (72%)



[GitHub] [servicecomb-java-chassis] cmkcmk181 closed issue #1900: @InjectProperty 注解无效

2020-07-30 Thread GitBox


cmkcmk181 closed issue #1900:
URL: https://github.com/apache/servicecomb-java-chassis/issues/1900


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] GuoYL123 commented on a change in pull request #1894: [SCB-2043] flow control support custom / bug fix

2020-07-30 Thread GitBox


GuoYL123 commented on a change in pull request #1894:
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1894#discussion_r462821368



##
File path: 
handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/QpsControllerManager.java
##
@@ -209,22 +210,25 @@ public QpsControllerManager setGlobalQpsStrategy(String 
globalLimitKey, String g
   }
 
   private AbstractQpsStrategy chooseStrategy(String globalConfigKey, Long 
limit, Long bucket,
-  String strategyKey) {
-AbstractQpsStrategy strategy;
-switch (StrategyType.parseStrategyType(strategyKey)) {
-  case FixedWindow:
-strategy = new FixedWindowStrategy(globalConfigKey, limit);
-break;
-  case LeakyBucket:
-strategy = new LeakyBucketStrategy(globalConfigKey, limit);
-break;
-  case TokenBucket:
-strategy = new TokenBucketStrategy(globalConfigKey, limit, bucket);
+  String strategyName) {
+if (StringUtils.isEmpty(strategyName)) {
+  strategyName = "FixedWindow";
+}
+AbstractQpsStrategy strategy = null;
+List strategyFactories = SPIServiceUtils
+.getOrLoadSortedService(IStrategyFactory.class);
+for (IStrategyFactory strategyFactory : strategyFactories) {
+  strategy = strategyFactory.getStrategy(strategyName);
+  if (strategy != null) {
 break;
-  case SlidingWindow:
-  default:
-strategy = new FixedWindowStrategy(globalConfigKey, limit);
+  }
+}
+if (strategy == null) {
+  throw new ServiceCombException("the qps strategy name is not exist , 
please check.");

Review comment:
   done

##
File path: 
handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/strategy/DefaultStrategyFactory.java
##
@@ -14,27 +14,20 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.servicecomb.qps.strategy;
 
-import org.apache.commons.lang3.StringUtils;
-
-public enum StrategyType {
-  TokenBucket,
-  LeakyBucket,
-  FixedWindow,
-  SlidingWindow;
-
-
-  public static StrategyType parseStrategyType(String type) {
-if (StringUtils.isEmpty(type)) {
-  return StrategyType.FixedWindow;
-}
+public class DefaultStrategyFactory implements IStrategyFactory {
 
-try {
-  return StrategyType.valueOf(type.toUpperCase());
-} catch (IllegalArgumentException e) {
-  return StrategyType.FixedWindow;
+  public AbstractQpsStrategy getStrategy(String strategyName) {

Review comment:
   done





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] liubao68 merged pull request #1899: [SCB-2049]fix trace id logger do not print error message in codes

2020-07-30 Thread GitBox


liubao68 merged pull request #1899:
URL: https://github.com/apache/servicecomb-java-chassis/pull/1899


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] liubao68 commented on a change in pull request #1894: [SCB-2043] flow control support custom / bug fix

2020-07-30 Thread GitBox


liubao68 commented on a change in pull request #1894:
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1894#discussion_r462717447



##
File path: 
handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/QpsControllerManager.java
##
@@ -209,22 +210,25 @@ public QpsControllerManager setGlobalQpsStrategy(String 
globalLimitKey, String g
   }
 
   private AbstractQpsStrategy chooseStrategy(String globalConfigKey, Long 
limit, Long bucket,
-  String strategyKey) {
-AbstractQpsStrategy strategy;
-switch (StrategyType.parseStrategyType(strategyKey)) {
-  case FixedWindow:
-strategy = new FixedWindowStrategy(globalConfigKey, limit);
-break;
-  case LeakyBucket:
-strategy = new LeakyBucketStrategy(globalConfigKey, limit);
-break;
-  case TokenBucket:
-strategy = new TokenBucketStrategy(globalConfigKey, limit, bucket);
+  String strategyName) {
+if (StringUtils.isEmpty(strategyName)) {
+  strategyName = "FixedWindow";
+}
+AbstractQpsStrategy strategy = null;
+List strategyFactories = SPIServiceUtils
+.getOrLoadSortedService(IStrategyFactory.class);
+for (IStrategyFactory strategyFactory : strategyFactories) {
+  strategy = strategyFactory.getStrategy(strategyName);
+  if (strategy != null) {
 break;
-  case SlidingWindow:
-  default:
-strategy = new FixedWindowStrategy(globalConfigKey, limit);
+  }
+}
+if (strategy == null) {
+  throw new ServiceCombException("the qps strategy name is not exist , 
please check.");

Review comment:
   exeception message is better to include `strategyName`

##
File path: 
handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/strategy/DefaultStrategyFactory.java
##
@@ -14,27 +14,20 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.servicecomb.qps.strategy;
 
-import org.apache.commons.lang3.StringUtils;
-
-public enum StrategyType {
-  TokenBucket,
-  LeakyBucket,
-  FixedWindow,
-  SlidingWindow;
-
-
-  public static StrategyType parseStrategyType(String type) {
-if (StringUtils.isEmpty(type)) {
-  return StrategyType.FixedWindow;
-}
+public class DefaultStrategyFactory implements IStrategyFactory {
 
-try {
-  return StrategyType.valueOf(type.toUpperCase());
-} catch (IllegalArgumentException e) {
-  return StrategyType.FixedWindow;
+  public AbstractQpsStrategy getStrategy(String strategyName) {

Review comment:
   It's better to use `createStrategy`





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] coveralls edited a comment on pull request #1894: [SCB-2043] flow control support custom / bug fix

2020-07-30 Thread GitBox


coveralls edited a comment on pull request #1894:
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1894#issuecomment-664256329


   
   [![Coverage 
Status](https://coveralls.io/builds/32415683/badge)](https://coveralls.io/builds/32415683)
   
   Coverage increased (+0.03%) to 86.332% when pulling 
**f62dee43e5517b3dcf80848aa50c44e6d11a7132 on GuoYL123:master** into 
**845d763e5bab180285116ab5a0d6f4ea5f528728 on apache:master**.
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [servicecomb-java-chassis] coveralls commented on pull request #1899: [SCB-2049]fix trace id logger do not print error message in codes

2020-07-30 Thread GitBox


coveralls commented on pull request #1899:
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1899#issuecomment-666102229


   
   [![Coverage 
Status](https://coveralls.io/builds/32417670/badge)](https://coveralls.io/builds/32417670)
   
   Coverage decreased (-0.001%) to 86.296% when pulling 
**da2c5707fb1d382f816eab299a655648c15a530d on liubao68:liubao** into 
**845d763e5bab180285116ab5a0d6f4ea5f528728 on apache:master**.
   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[servicecomb-java-chassis] branch master updated: [SCB-2049]fix trace id logger do not print error message in codes

2020-07-30 Thread liubao
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git


The following commit(s) were added to refs/heads/master by this push:
 new 531e121  [SCB-2049]fix trace id logger do not print error message in 
codes
531e121 is described below

commit 531e1218e51800e05220bce7ed0dbd0ef16db28c
Author: liubao 
AuthorDate: Wed Jul 29 16:34:04 2020 +0800

[SCB-2049]fix trace id logger do not print error message in codes
---
 .../core/handler/impl/ProducerOperationHandler.java   |  8 
 .../rest/client/http/RestClientInvocation.java| 19 ---
 .../rest/client/http/TestRestClientInvocation.java|  4 +++-
 3 files changed, 19 insertions(+), 12 deletions(-)

diff --git 
a/core/src/main/java/org/apache/servicecomb/core/handler/impl/ProducerOperationHandler.java
 
b/core/src/main/java/org/apache/servicecomb/core/handler/impl/ProducerOperationHandler.java
index 3845e6b..ed81e4b 100644
--- 
a/core/src/main/java/org/apache/servicecomb/core/handler/impl/ProducerOperationHandler.java
+++ 
b/core/src/main/java/org/apache/servicecomb/core/handler/impl/ProducerOperationHandler.java
@@ -92,8 +92,8 @@ public class ProducerOperationHandler implements Handler {
   });
 } catch (Throwable e) {
   if (shouldPrintErrorLog(e)) {
-invocation.getTraceIdLogger().error(LOGGER, "unexpected error {},",
-invocation.getInvocationQualifiedName(), e);
+invocation.getTraceIdLogger().error(LOGGER, "unexpected error {}, 
message={}",
+invocation.getInvocationQualifiedName(), e.getMessage());
   }
   invocation.onBusinessMethodFinish();
   invocation.onBusinessFinish();
@@ -125,8 +125,8 @@ public class ProducerOperationHandler implements Handler {
   invocation.onBusinessFinish();
 } catch (Throwable e) {
   if (shouldPrintErrorLog(e)) {
-invocation.getTraceIdLogger().error(LOGGER, "unexpected error {},",
-invocation.getInvocationQualifiedName(), e);
+invocation.getTraceIdLogger().error(LOGGER, "unexpected error 
operation={}, message={}",
+invocation.getInvocationQualifiedName(), e.getMessage());
   }
   invocation.onBusinessMethodFinish();
   invocation.onBusinessFinish();
diff --git 
a/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/http/RestClientInvocation.java
 
b/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/http/RestClientInvocation.java
index 59803ed..838131d 100644
--- 
a/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/http/RestClientInvocation.java
+++ 
b/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/http/RestClientInvocation.java
@@ -33,6 +33,7 @@ import 
org.apache.servicecomb.core.invocation.InvocationStageTrace;
 import org.apache.servicecomb.foundation.common.http.HttpStatus;
 import org.apache.servicecomb.foundation.common.net.IpPort;
 import org.apache.servicecomb.foundation.common.net.URIEndpointObject;
+import org.apache.servicecomb.foundation.common.utils.ExceptionUtils;
 import org.apache.servicecomb.foundation.common.utils.JsonUtils;
 import 
org.apache.servicecomb.foundation.vertx.client.http.HttpClientWithContext;
 import org.apache.servicecomb.foundation.vertx.http.HttpServletRequestEx;
@@ -114,8 +115,8 @@ public class RestClientInvocation {
 }
 
 clientRequest.exceptionHandler(e -> {
-  invocation.getTraceIdLogger().error(LOGGER, "Failed to send request, 
local:{}, remote:{}.",
-  getLocalAddress(), ipPort.getSocketAddress(), e);
+  invocation.getTraceIdLogger().error(LOGGER, "Failed to send request, 
local:{}, remote:{}, message={}.",
+  getLocalAddress(), ipPort.getSocketAddress(), 
ExceptionUtils.getExceptionMessageWithoutTrace(e));
   throwableHandler.handle(e);
 });
 
@@ -128,7 +129,8 @@ public class RestClientInvocation {
 restClientRequest.end();
   } catch (Throwable e) {
 invocation.getTraceIdLogger().error(LOGGER,
-"send http request failed, local:{}, remote: {}.", 
getLocalAddress(), ipPort, e);
+"send http request failed, local:{}, remote: {}, message={}.", 
getLocalAddress(), ipPort
+, ExceptionUtils.getExceptionMessageWithoutTrace(e));
 fail((ConnectionBase) clientRequest.connection(), e);
   }
 });
@@ -198,8 +200,9 @@ public class RestClientInvocation {
 }
 
 httpClientResponse.exceptionHandler(e -> {
-  invocation.getTraceIdLogger().error(LOGGER, "Failed to receive response, 
local:{}, remote:{}.",
-  getLocalAddress(), httpClientResponse.netSocket().remoteAddress(), 
e);
+  invocation.getTraceIdLogger().error(LOGGER, "Failed to receive response, 

[servicecomb-java-chassis] branch master updated: [SCB-2049]fix trace id logger do not print error message in codes

2020-07-30 Thread liubao
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git


The following commit(s) were added to refs/heads/master by this push:
 new 531e121  [SCB-2049]fix trace id logger do not print error message in 
codes
531e121 is described below

commit 531e1218e51800e05220bce7ed0dbd0ef16db28c
Author: liubao 
AuthorDate: Wed Jul 29 16:34:04 2020 +0800

[SCB-2049]fix trace id logger do not print error message in codes
---
 .../core/handler/impl/ProducerOperationHandler.java   |  8 
 .../rest/client/http/RestClientInvocation.java| 19 ---
 .../rest/client/http/TestRestClientInvocation.java|  4 +++-
 3 files changed, 19 insertions(+), 12 deletions(-)

diff --git 
a/core/src/main/java/org/apache/servicecomb/core/handler/impl/ProducerOperationHandler.java
 
b/core/src/main/java/org/apache/servicecomb/core/handler/impl/ProducerOperationHandler.java
index 3845e6b..ed81e4b 100644
--- 
a/core/src/main/java/org/apache/servicecomb/core/handler/impl/ProducerOperationHandler.java
+++ 
b/core/src/main/java/org/apache/servicecomb/core/handler/impl/ProducerOperationHandler.java
@@ -92,8 +92,8 @@ public class ProducerOperationHandler implements Handler {
   });
 } catch (Throwable e) {
   if (shouldPrintErrorLog(e)) {
-invocation.getTraceIdLogger().error(LOGGER, "unexpected error {},",
-invocation.getInvocationQualifiedName(), e);
+invocation.getTraceIdLogger().error(LOGGER, "unexpected error {}, 
message={}",
+invocation.getInvocationQualifiedName(), e.getMessage());
   }
   invocation.onBusinessMethodFinish();
   invocation.onBusinessFinish();
@@ -125,8 +125,8 @@ public class ProducerOperationHandler implements Handler {
   invocation.onBusinessFinish();
 } catch (Throwable e) {
   if (shouldPrintErrorLog(e)) {
-invocation.getTraceIdLogger().error(LOGGER, "unexpected error {},",
-invocation.getInvocationQualifiedName(), e);
+invocation.getTraceIdLogger().error(LOGGER, "unexpected error 
operation={}, message={}",
+invocation.getInvocationQualifiedName(), e.getMessage());
   }
   invocation.onBusinessMethodFinish();
   invocation.onBusinessFinish();
diff --git 
a/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/http/RestClientInvocation.java
 
b/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/http/RestClientInvocation.java
index 59803ed..838131d 100644
--- 
a/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/http/RestClientInvocation.java
+++ 
b/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/http/RestClientInvocation.java
@@ -33,6 +33,7 @@ import 
org.apache.servicecomb.core.invocation.InvocationStageTrace;
 import org.apache.servicecomb.foundation.common.http.HttpStatus;
 import org.apache.servicecomb.foundation.common.net.IpPort;
 import org.apache.servicecomb.foundation.common.net.URIEndpointObject;
+import org.apache.servicecomb.foundation.common.utils.ExceptionUtils;
 import org.apache.servicecomb.foundation.common.utils.JsonUtils;
 import 
org.apache.servicecomb.foundation.vertx.client.http.HttpClientWithContext;
 import org.apache.servicecomb.foundation.vertx.http.HttpServletRequestEx;
@@ -114,8 +115,8 @@ public class RestClientInvocation {
 }
 
 clientRequest.exceptionHandler(e -> {
-  invocation.getTraceIdLogger().error(LOGGER, "Failed to send request, 
local:{}, remote:{}.",
-  getLocalAddress(), ipPort.getSocketAddress(), e);
+  invocation.getTraceIdLogger().error(LOGGER, "Failed to send request, 
local:{}, remote:{}, message={}.",
+  getLocalAddress(), ipPort.getSocketAddress(), 
ExceptionUtils.getExceptionMessageWithoutTrace(e));
   throwableHandler.handle(e);
 });
 
@@ -128,7 +129,8 @@ public class RestClientInvocation {
 restClientRequest.end();
   } catch (Throwable e) {
 invocation.getTraceIdLogger().error(LOGGER,
-"send http request failed, local:{}, remote: {}.", 
getLocalAddress(), ipPort, e);
+"send http request failed, local:{}, remote: {}, message={}.", 
getLocalAddress(), ipPort
+, ExceptionUtils.getExceptionMessageWithoutTrace(e));
 fail((ConnectionBase) clientRequest.connection(), e);
   }
 });
@@ -198,8 +200,9 @@ public class RestClientInvocation {
 }
 
 httpClientResponse.exceptionHandler(e -> {
-  invocation.getTraceIdLogger().error(LOGGER, "Failed to receive response, 
local:{}, remote:{}.",
-  getLocalAddress(), httpClientResponse.netSocket().remoteAddress(), 
e);
+  invocation.getTraceIdLogger().error(LOGGER, "Failed to receive response,