You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2022/07/27 03:40:49 UTC
[GitHub] [servicecomb-java-chassis] YOC19970520 opened a new pull request, #3228: Route Rule
YOC19970520 opened a new pull request, #3228:
URL: https://github.com/apache/servicecomb-java-chassis/pull/3228
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.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [servicecomb-java-chassis] liubao68 commented on a diff in pull request #3228: Route Rule
Posted by GitBox <gi...@apache.org>.
liubao68 commented on code in PR #3228:
URL: https://github.com/apache/servicecomb-java-chassis/pull/3228#discussion_r930599856
##########
foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/TestJvmUtils.java:
##########
@@ -18,6 +18,8 @@
import mockit.Mock;
import mockit.MockUp;
+
+
Review Comment:
revert this change
--
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.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [servicecomb-java-chassis] liubao68 merged pull request #3228: [SCB-2645] Fix route rule will throw NPE when version is empty
Posted by GitBox <gi...@apache.org>.
liubao68 merged PR #3228:
URL: https://github.com/apache/servicecomb-java-chassis/pull/3228
--
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.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [servicecomb-java-chassis] liubao68 commented on a diff in pull request #3228: Route Rule
Posted by GitBox <gi...@apache.org>.
liubao68 commented on code in PR #3228:
URL: https://github.com/apache/servicecomb-java-chassis/pull/3228#discussion_r930644660
##########
governance/src/test/resources/application.yaml:
##########
@@ -144,3 +144,31 @@ servicecomb:
wrongIngored: |
delayTime: -1
type: ERROR
+
+ routeRule:
+ test_server: | # 服务名
+ - precedence: 1 # 优先级,数字越大,优先级越高。
+ match: # 请求匹配规则。0..N个,不配置表示匹配。
+ headers: # header 匹配
+ region: # 如果配置了多个 header,那么所有的 header 规则都必须和请求匹配
+ exact: 'providerRegion'
+ caseInsensitive: false # 不区分大小写
+ type:
+ regex: gray_[a-z]+ # java 正则表达式匹配
+ caseInsensitive: true # 区分大小写
+ route: # 路由规则
+ - weight: 20 # 权重值
+ tags:
+ version: 1.0.0 # 实例标记。满足标记条件的实例放到这一组。
+ - weight: 80 # 权重值
+ tags:
+ version: 2.0.0 # 实例标记。满足标记条件的实例放到这一组。
+
+ - precedence: 2
+ route:
+ - weight: 20
+ tags:
+ x-group: red
+ - weight: 80
+ tags:
+ x-group: green
Review Comment:
add EOL
--
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.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [servicecomb-java-chassis] liubao68 commented on a diff in pull request #3228: Route Rule
Posted by GitBox <gi...@apache.org>.
liubao68 commented on code in PR #3228:
URL: https://github.com/apache/servicecomb-java-chassis/pull/3228#discussion_r930600802
##########
governance/src/test/java/org/apache/servicecomb/router/DistributeTest.java:
##########
@@ -0,0 +1,92 @@
+package org.apache.servicecomb.router;
Review Comment:
add license
--
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.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [servicecomb-java-chassis] codecov-commenter commented on pull request #3228: Route Rule
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #3228:
URL: https://github.com/apache/servicecomb-java-chassis/pull/3228#issuecomment-1196657838
# [Codecov](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/3228?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#3228](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/3228?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (a650f86) into [master](https://codecov.io/gh/apache/servicecomb-java-chassis/commit/526da8576aefb0b47a12b7d9a361f76c97438448?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (526da85) will **increase** coverage by `0.03%`.
> The diff coverage is `0.00%`.
```diff
@@ Coverage Diff @@
## master #3228 +/- ##
============================================
+ Coverage 77.46% 77.49% +0.03%
Complexity 1439 1439
============================================
Files 1629 1629
Lines 43432 43406 -26
Branches 3654 3652 -2
============================================
- Hits 33644 33639 -5
+ Misses 8276 8262 -14
+ Partials 1512 1505 -7
```
| [Impacted Files](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/3228?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...b/router/distribute/AbstractRouterDistributor.java](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/3228/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Z292ZXJuYW5jZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2VydmljZWNvbWIvcm91dGVyL2Rpc3RyaWJ1dGUvQWJzdHJhY3RSb3V0ZXJEaXN0cmlidXRvci5qYXZh) | `80.88% <0.00%> (-0.94%)` | :arrow_down: |
| [...org/apache/servicecomb/router/model/RouteItem.java](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/3228/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Z292ZXJuYW5jZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2VydmljZWNvbWIvcm91dGVyL21vZGVsL1JvdXRlSXRlbS5qYXZh) | `57.14% <0.00%> (ø)` | |
| [.../servicecomb/registry/discovery/DiscoveryTree.java](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/3228/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Zm91bmRhdGlvbnMvZm91bmRhdGlvbi1yZWdpc3RyeS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2VydmljZWNvbWIvcmVnaXN0cnkvZGlzY292ZXJ5L0Rpc2NvdmVyeVRyZWUuamF2YQ==) | `96.49% <0.00%> (-3.51%)` | :arrow_down: |
| [.../apache/servicecomb/loadbalance/Configuration.java](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/3228/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aGFuZGxlcnMvaGFuZGxlci1sb2FkYmFsYW5jZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2VydmljZWNvbWIvbG9hZGJhbGFuY2UvQ29uZmlndXJhdGlvbi5qYXZh) | `61.53% <0.00%> (-3.08%)` | :arrow_down: |
| [...icecomb/bizkeeper/HystrixCommandPropertiesExt.java](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/3228/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aGFuZGxlcnMvaGFuZGxlci1iaXprZWVwZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NlcnZpY2Vjb21iL2JpemtlZXBlci9IeXN0cml4Q29tbWFuZFByb3BlcnRpZXNFeHQuamF2YQ==) | `92.25% <0.00%> (-1.41%)` | :arrow_down: |
| [...comb/loadbalance/ServiceCombLoadBalancerStats.java](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/3228/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aGFuZGxlcnMvaGFuZGxlci1sb2FkYmFsYW5jZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2VydmljZWNvbWIvbG9hZGJhbGFuY2UvU2VydmljZUNvbWJMb2FkQmFsYW5jZXJTdGF0cy5qYXZh) | `82.43% <0.00%> (-1.36%)` | :arrow_down: |
| [...mb/core/handler/impl/ProducerOperationHandler.java](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/3228/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2VydmljZWNvbWIvY29yZS9oYW5kbGVyL2ltcGwvUHJvZHVjZXJPcGVyYXRpb25IYW5kbGVyLmphdmE=) | `50.63% <0.00%> (-0.65%)` | :arrow_down: |
| [...rvice/center/client/ServiceCenterRegistration.java](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/3228/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y2xpZW50cy9zZXJ2aWNlLWNlbnRlci1jbGllbnQvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NlcnZpY2Vjb21iL3NlcnZpY2UvY2VudGVyL2NsaWVudC9TZXJ2aWNlQ2VudGVyUmVnaXN0cmF0aW9uLmphdmE=) | `0.00% <0.00%> (ø)` | |
| [...enter/client/model/ServiceCenterConfiguration.java](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/3228/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y2xpZW50cy9zZXJ2aWNlLWNlbnRlci1jbGllbnQvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NlcnZpY2Vjb21iL3NlcnZpY2UvY2VudGVyL2NsaWVudC9tb2RlbC9TZXJ2aWNlQ2VudGVyQ29uZmlndXJhdGlvbi5qYXZh) | `0.00% <0.00%> (ø)` | |
| [...b/loadbalance/filter/ZoneAwareDiscoveryFilter.java](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/3228/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aGFuZGxlcnMvaGFuZGxlci1sb2FkYmFsYW5jZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2VydmljZWNvbWIvbG9hZGJhbGFuY2UvZmlsdGVyL1pvbmVBd2FyZURpc2NvdmVyeUZpbHRlci5qYXZh) | | |
| ... and [14 more](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/3228/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [servicecomb-java-chassis] liubao68 commented on a diff in pull request #3228: Route Rule
Posted by GitBox <gi...@apache.org>.
liubao68 commented on code in PR #3228:
URL: https://github.com/apache/servicecomb-java-chassis/pull/3228#discussion_r930994481
##########
governance/src/test/java/org/apache/servicecomb/router/distribute/DistributeTest.java:
##########
@@ -0,0 +1,116 @@
+/*
+ * 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.router.distribute;
+
+import org.apache.servicecomb.router.RouterFilter;
+import org.apache.servicecomb.router.ServiceIns;
+import org.apache.servicecomb.router.model.PolicyRuleItem;
+import org.apache.servicecomb.router.model.RouteItem;
+import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.ConfigDataApplicationContextInitializer;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringRunner;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+@RunWith(SpringRunner.class)
+@ContextConfiguration(locations = "classpath:META-INF/spring/*.xml", initializers = ConfigDataApplicationContextInitializer.class)
+public class DistributeTest {
+ private static final String TARGET_SERVICE_NAME = "test_server1";
+ private RouterFilter routerFilter;
+ private RouterDistributor<ServiceIns, ServiceIns> routerDistributor;
+
+ @Autowired
+ public void setRouterFilter(RouterFilter routerFilter) {
+ this.routerFilter = routerFilter;
+ }
+ @Autowired
+ public void setRouterDistributor(RouterDistributor<ServiceIns, ServiceIns> routerDistributor) {
+ this.routerDistributor = routerDistributor;
+ }
+
+ @Test
+ public void testDistribute(){
+ PolicyRuleItem policyRuleItem = initPolicyRuleItem();
Review Comment:
seams no use code
--
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.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org