You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2020/08/07 18:33:07 UTC

[GitHub] [dubbo-go] watermelo opened a new pull request #703: Add: add setInvoker function for router chain

watermelo opened a new pull request #703:
URL: https://github.com/apache/dubbo-go/pull/703


   <!--  Thanks for sending a pull request! 
   -->
   
   **What this PR does**:
   
   **Which issue(s) this PR fixes**:
   <!--
   *Automatically closes linked issue when PR is merged.
   Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
   _If PR is about `failing-tests or flakes`, please post the related issues/tests in a comment and do not use `Fixes`_*
   -->
   Fixes #
   
   **Special notes for your reviewer**:
   
   **Does this PR introduce a user-facing change?**:
   <!--
   If no, just write "NONE" in the release-note block below.
   If yes, a release note is required:
   Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required".
   -->
   ```release-note
   
   ```


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] hxmhlt commented on a change in pull request #703: Ftr: add dynamic tag router

Posted by GitBox <gi...@apache.org>.
hxmhlt commented on a change in pull request #703:
URL: https://github.com/apache/dubbo-go/pull/703#discussion_r468512695



##########
File path: cluster/router/chain/chain.go
##########
@@ -65,6 +65,15 @@ func (c *RouterChain) Route(invoker []protocol.Invoker, url *common.URL, invocat
 	return finalInvokers
 }
 
+// Notify router chain of the initial addresses from registry at the first time. Notify whenever addresses in registry change.
+func (c *RouterChain) SetInvokers(invokers []protocol.Invoker) {

Review comment:
       Your comment may start with func name.

##########
File path: cluster/router/tag/router_rule.go
##########
@@ -22,9 +22,27 @@ import (
 	"github.com/apache/dubbo-go/common/yaml"
 )
 
+/**
+ * %YAML1.2
+ * ---
+ * force: true
+ * runtime: false
+ * enabled: true
+ * priority: 1
+ * key: demo-provider
+ * tags:
+ * - name: tag1
+ * addresses: [ip1, ip2]
+ * - name: tag2
+ * addresses: [ip3, ip4]
+ * ...
+ */
 // RouterRule RouterRule config read from config file or config center
 type RouterRule struct {
-	router.BaseRouterRule `yaml:",inline"`
+	router.BaseRouterRule `yaml:",inline""`

Review comment:
       I saw three " , is this right?

##########
File path: cluster/router/tag/router_rule.go
##########
@@ -34,5 +52,54 @@ func getRule(rawRule string) (*RouterRule, error) {
 		return r, err
 	}
 	r.RawRule = rawRule
+	r.init()
 	return r, nil
 }
+
+// init use for flattening tags data to @addressToTagNames and @tagNameToAddresses
+func (t *RouterRule) init() {
+	t.addressToTagNames = make(map[string][]string, 2*len(t.Tags))

Review comment:
       I do not think named `init` is golang native.  Because `init` is golang's  special func. Maybe   func (t *RouterRule)NewRouterRule is .

##########
File path: cluster/router/tag/tag.go
##########
@@ -0,0 +1,39 @@
+/*
+ * 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 tag
+
+type Tag struct {
+	Name      string
+	Addresses []string
+}
+

Review comment:
       I do not think golang need 'getXXX' . 




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] zouyx commented on a change in pull request #703: Ftr: add dynamic tag router

Posted by GitBox <gi...@apache.org>.
zouyx commented on a change in pull request #703:
URL: https://github.com/apache/dubbo-go/pull/703#discussion_r467545829



##########
File path: cluster/router/tag/tag_router.go
##########
@@ -55,15 +64,118 @@ func (c *tagRouter) isEnabled() bool {
 	return c.enabled
 }
 
+func (c *tagRouter) tagRouterRuleCopy() RouterRule {
+	routerRule := *c.tagRouterRule
+	return routerRule
+}
+
 // Route gets a list of invoker
 func (c *tagRouter) Route(invokers []protocol.Invoker, url *common.URL, invocation protocol.Invocation) []protocol.Invoker {
-	if !c.isEnabled() {
+	var (
+		result    []protocol.Invoker
+		addresses []string
+	)
+
+	if !c.isEnabled() || len(invokers) == 0 {
 		return invokers
 	}
+
+	// Use static tags if dynamic tags are not set or invalid
+	if c.tagRouterRule == nil || !c.tagRouterRule.Valid || !c.tagRouterRule.Enabled {
+		return filterUsingStaticTag(invokers, url, invocation)
+	}
+
+	// since the rule can be changed by config center, we should copy one to use.
+	tagRouterRuleCopy := c.tagRouterRuleCopy()
+	tag, ok := invocation.Attachments()[constant.Tagkey]
+	if !ok {
+		tag = url.GetParam(constant.Tagkey, "")
+	}
+
+	// if we are requesting for a Provider with a specific tag
+	if len(tag) > 0 {
+		return filterInvokersWithTag(invokers, url, invocation, tagRouterRuleCopy, tag)
+	}
+
+	// return all addresses in dynamic tag group.
+	addresses = tagRouterRuleCopy.getAddresses()
+	if len(addresses) > 0 {
+		filterAddressNotMatches := func(invoker protocol.Invoker) bool {
+			url := invoker.GetUrl()
+			return len(addresses) == 0 || !checkAddressMatch(addresses, url.Ip, url.Port)
+		}
+		result = filterInvoker(invokers, filterAddressNotMatches)
+		// 1. all addresses are in dynamic tag group, return empty list.
+		if len(result) == 0 {
+			return result
+		}
+	}
+	// 2. if there are some addresses that are not in any dynamic tag group, continue to filter using the
+	// static tag group.
+	filter := func(invoker protocol.Invoker) bool {
+		localTag := invoker.GetUrl().GetParam(constant.Tagkey, "")
+		return localTag == "" || !(tagRouterRuleCopy.hasTag(localTag))

Review comment:
       ```suggestion
   		return len(localTag)==0|| !(tagRouterRuleCopy.hasTag(localTag))
   ```

##########
File path: cluster/router/router.go
##########
@@ -50,3 +50,14 @@ type PriorityRouter interface {
 	// 0 to ^int(0) is better
 	Priority() int64
 }
+
+// NotifyRouter notify router use the invoker list. Invoker list may change from time to time. This method gives the router a
+// chance to prepare before {@link Router#route(List, URL, Invocation)} gets called.
+type NotifyRouter interface {
+	router

Review comment:
       ```suggestion
   	PriorityRouter
   ```
   if `NotifyRouter ` is a `PriorityRouter` , you just extends `PriorityRouter` not router.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] AlexStocks merged pull request #703: Ftr: add dynamic tag router

Posted by GitBox <gi...@apache.org>.
AlexStocks merged pull request #703:
URL: https://github.com/apache/dubbo-go/pull/703


   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] AlexStocks commented on a change in pull request #703: Ftr: add dynamic tag router

Posted by GitBox <gi...@apache.org>.
AlexStocks commented on a change in pull request #703:
URL: https://github.com/apache/dubbo-go/pull/703#discussion_r470206063



##########
File path: cluster/router/tag/tag_router.go
##########
@@ -93,10 +204,81 @@ func filterUsingStaticTag(invokers []protocol.Invoker, url *common.URL, invocati
 	return invokers
 }
 
+// filterInvokersWithTag gets a list of invoker using dynamic route with tag
+func filterInvokersWithTag(invokers []protocol.Invoker, url *common.URL, invocation protocol.Invocation, tagRouterRule RouterRule, tag string) []protocol.Invoker {
+	var (
+		result    []protocol.Invoker
+		addresses []string
+	)
+	addresses, _ = tagRouterRule.getTagNameToAddresses()[tag]
+	// filter by dynamic tag group first
+	if len(addresses) > 0 {
+		filterAddressMatches := func(invoker protocol.Invoker) bool {
+			url := invoker.GetUrl()
+			return len(addresses) > 0 && checkAddressMatch(addresses, url.Ip, url.Port)
+		}
+		result = filterInvoker(invokers, filterAddressMatches)
+		if len(result) > 0 || tagRouterRule.Force {
+			return result
+		}
+	} else {
+		// dynamic tag group doesn't have any item about the requested app OR it's null after filtered by
+		// dynamic tag group but force=false. check static tag
+		filter := func(invoker protocol.Invoker) bool {
+			return invoker.GetUrl().GetParam(constant.Tagkey, "") == tag
+		}
+		result = filterInvoker(invokers, filter)
+	}
+	// If there's no tagged providers that can match the current tagged request. force.tag is set by default
+	// to false, which means it will invoke any providers without a tag unless it's explicitly disallowed.
+	if len(result) > 0 || isForceUseTag(url, invocation) {
+		return result
+	} else {

Review comment:
       pls delete the else.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] watermelo commented on a change in pull request #703: Ftr: add dynamic tag router

Posted by GitBox <gi...@apache.org>.
watermelo commented on a change in pull request #703:
URL: https://github.com/apache/dubbo-go/pull/703#discussion_r469210009



##########
File path: cluster/router/tag/router_rule.go
##########
@@ -22,9 +22,27 @@ import (
 	"github.com/apache/dubbo-go/common/yaml"
 )
 
+/**
+ * %YAML1.2
+ * ---
+ * force: true
+ * runtime: false
+ * enabled: true
+ * priority: 1
+ * key: demo-provider
+ * tags:
+ * - name: tag1
+ * addresses: [ip1, ip2]
+ * - name: tag2
+ * addresses: [ip3, ip4]
+ * ...
+ */
 // RouterRule RouterRule config read from config file or config center
 type RouterRule struct {
-	router.BaseRouterRule `yaml:",inline"`
+	router.BaseRouterRule `yaml:",inline""`

Review comment:
       It's old codes on purpose, when delete it will be parsed fail




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] codecov-commenter commented on pull request #703: Ftr: add dynamic tag router

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #703:
URL: https://github.com/apache/dubbo-go/pull/703#issuecomment-672834033


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/703?src=pr&el=h1) Report
   > Merging [#703](https://codecov.io/gh/apache/dubbo-go/pull/703?src=pr&el=desc) into [develop](https://codecov.io/gh/apache/dubbo-go/commit/03bde755952c756b6d5e1875186ab5c4f875e67c&el=desc) will **decrease** coverage by `0.15%`.
   > The diff coverage is `71.15%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/703/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL)](https://codecov.io/gh/apache/dubbo-go/pull/703?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           develop     #703      +/-   ##
   ===========================================
   - Coverage    63.93%   63.77%   -0.16%     
   ===========================================
     Files          238      239       +1     
     Lines        12487    12778     +291     
   ===========================================
   + Hits          7983     8149     +166     
   - Misses        3740     3833      +93     
   - Partials       764      796      +32     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/703?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [cluster/cluster\_impl/base\_cluster\_invoker.go](https://codecov.io/gh/apache/dubbo-go/pull/703/diff?src=pr&el=tree#diff-Y2x1c3Rlci9jbHVzdGVyX2ltcGwvYmFzZV9jbHVzdGVyX2ludm9rZXIuZ28=) | `72.15% <ø> (ø)` | |
   | [cluster/loadbalance/consistent\_hash.go](https://codecov.io/gh/apache/dubbo-go/pull/703/diff?src=pr&el=tree#diff-Y2x1c3Rlci9sb2FkYmFsYW5jZS9jb25zaXN0ZW50X2hhc2guZ28=) | `90.32% <ø> (ø)` | |
   | [common/url.go](https://codecov.io/gh/apache/dubbo-go/pull/703/diff?src=pr&el=tree#diff-Y29tbW9uL3VybC5nbw==) | `65.95% <0.00%> (ø)` | |
   | [common/yaml/yaml.go](https://codecov.io/gh/apache/dubbo-go/pull/703/diff?src=pr&el=tree#diff-Y29tbW9uL3lhbWwveWFtbC5nbw==) | `86.66% <0.00%> (-13.34%)` | :arrow_down: |
   | [config/base\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/703/diff?src=pr&el=tree#diff-Y29uZmlnL2Jhc2VfY29uZmlnLmdv) | `68.12% <ø> (ø)` | |
   | [config/provider\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/703/diff?src=pr&el=tree#diff-Y29uZmlnL3Byb3ZpZGVyX2NvbmZpZy5nbw==) | `58.06% <0.00%> (ø)` | |
   | [protocol/dubbo/client.go](https://codecov.io/gh/apache/dubbo-go/pull/703/diff?src=pr&el=tree#diff-cHJvdG9jb2wvZHViYm8vY2xpZW50Lmdv) | `69.09% <ø> (ø)` | |
   | [protocol/dubbo/codec.go](https://codecov.io/gh/apache/dubbo-go/pull/703/diff?src=pr&el=tree#diff-cHJvdG9jb2wvZHViYm8vY29kZWMuZ28=) | `72.50% <ø> (ø)` | |
   | [protocol/grpc/server.go](https://codecov.io/gh/apache/dubbo-go/pull/703/diff?src=pr&el=tree#diff-cHJvdG9jb2wvZ3JwYy9zZXJ2ZXIuZ28=) | `68.42% <ø> (ø)` | |
   | [protocol/result.go](https://codecov.io/gh/apache/dubbo-go/pull/703/diff?src=pr&el=tree#diff-cHJvdG9jb2wvcmVzdWx0Lmdv) | `0.00% <ø> (ø)` | |
   | ... and [36 more](https://codecov.io/gh/apache/dubbo-go/pull/703/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/703?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/703?src=pr&el=footer). Last update [25281bf...6cf2dc8](https://codecov.io/gh/apache/dubbo-go/pull/703?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] gaoxinge commented on a change in pull request #703: Ftr: add dynamic tag router

Posted by GitBox <gi...@apache.org>.
gaoxinge commented on a change in pull request #703:
URL: https://github.com/apache/dubbo-go/pull/703#discussion_r467970835



##########
File path: before_ut.sh
##########
@@ -36,5 +36,8 @@ cp ${zkJar} cluster/router/chain/zookeeper-4unittest/contrib/fatjar
 mkdir -p cluster/router/condition/zookeeper-4unittest/contrib/fatjar
 cp ${zkJar} cluster/router/condition/zookeeper-4unittest/contrib/fatjar
 
+mkdir -p cluster/router/tag/zookeeper-4unittest/contrib/fatjar
+cp ${zkJar} cluster/router/tag/zookeeper-4unittest/contrib/fatjar

Review comment:
       Also apply this change to file https://github.com/apache/dubbo-go/blob/master/before_ut.bat.

##########
File path: cluster/router/tag/tag_router.go
##########
@@ -93,10 +205,211 @@ func filterUsingStaticTag(invokers []protocol.Invoker, url *common.URL, invocati
 	return invokers
 }
 
+// filterInvokersWithTag gets a list of invoker using dynamic route with tag
+func filterInvokersWithTag(invokers []protocol.Invoker, url *common.URL, invocation protocol.Invocation, tagRouterRule RouterRule, tag string) []protocol.Invoker {
+	var (
+		result    []protocol.Invoker
+		addresses []string
+	)
+	addresses, _ = tagRouterRule.getTagNameToAddresses()[tag]
+	// filter by dynamic tag group first
+	if len(addresses) > 0 {
+		filterAddressMatches := func(invoker protocol.Invoker) bool {
+			url := invoker.GetUrl()
+			return len(addresses) > 0 && checkAddressMatch(addresses, url.Ip, url.Port)
+		}
+		result = filterInvoker(invokers, filterAddressMatches)
+		if len(result) > 0 || tagRouterRule.Force {
+			return result
+		}
+	} else {
+		// dynamic tag group doesn't have any item about the requested app OR it's null after filtered by
+		// dynamic tag group but force=false. check static tag
+		filter := func(invoker protocol.Invoker) bool {
+			return invoker.GetUrl().GetParam(constant.Tagkey, "") == tag
+		}
+		result = filterInvoker(invokers, filter)
+	}
+	// If there's no tagged providers that can match the current tagged request. force.tag is set by default
+	// to false, which means it will invoke any providers without a tag unless it's explicitly disallowed.
+	if len(result) > 0 || isForceUseTag(url, invocation) {
+		return result
+	} else {
+		// FAILOVER: return all Providers without any tags.
+		filterAddressNotMatches := func(invoker protocol.Invoker) bool {
+			url := invoker.GetUrl()
+			return len(addresses) == 0 || !checkAddressMatch(tagRouterRule.getAddresses(), url.Ip, url.Port)
+		}
+		filterTagIsEmpty := func(invoker protocol.Invoker) bool {
+			return invoker.GetUrl().GetParam(constant.Tagkey, "") == ""
+		}
+		return filterInvoker(invokers, filterAddressNotMatches, filterTagIsEmpty)
+	}
+}
+
 // isForceUseTag returns whether force use tag
 func isForceUseTag(url *common.URL, invocation protocol.Invocation) bool {
 	if b, e := strconv.ParseBool(invocation.AttachmentsByKey(constant.ForceUseTag, url.GetParam(constant.ForceUseTag, "false"))); e == nil {
 		return b
 	}
 	return false
 }
+
+type filter func(protocol.Invoker) bool
+
+func filterInvoker(invokers []protocol.Invoker, filters ...filter) []protocol.Invoker {
+	var res []protocol.Invoker
+OUTER:
+	for _, invoker := range invokers {
+		for _, filter := range filters {
+			if !filter(invoker) {
+				continue OUTER
+			}
+		}
+		res = append(res, invoker)
+	}
+	return res
+}
+
+func checkAddressMatch(addresses []string, host, port string) bool {
+	for _, address := range addresses {
+		if matchIp(address, host, port) {
+			return true
+		}
+		if address == net.JoinHostPort(constant.ANYHOST_VALUE, port) {

Review comment:
       `net.JoinHostPort(constant.ANYHOST_VALUE, port)` is independent of the cycle, so it may be better to assign it to a value before cycle starts.

##########
File path: cluster/router/tag/tag_router_test.go
##########
@@ -160,3 +187,187 @@ func TestTagRouterRouteNoForce(t *testing.T) {
 	invRst2 := tagRouter.Route(invokers, &u1, inv)
 	assert.Equal(t, 3, len(invRst2))
 }
+
+func TestFilterInvoker(t *testing.T) {
+	u2, e2 := common.NewURL(tagRouterTestHangZhouUrl)
+	u3, e3 := common.NewURL(tagRouterTestShangHaiUrl)
+	u4, e4 := common.NewURL(tagRouterTestBeijingUrl)
+	u5, e5 := common.NewURL(tagRouterTestEnabledBeijingUrl)
+	assert.Nil(t, e2)
+	assert.Nil(t, e3)
+	assert.Nil(t, e4)
+	assert.Nil(t, e5)
+	inv2 := NewMockInvoker(u2)
+	inv3 := NewMockInvoker(u3)
+	inv4 := NewMockInvoker(u4)
+	inv5 := NewMockInvoker(u5)
+	var invokers []protocol.Invoker
+	invokers = append(invokers, inv2, inv3, inv4, inv5)
+	filterTag := func(invoker protocol.Invoker) bool {
+		if invoker.GetUrl().GetParam(constant.Tagkey, "") == "beijing" {

Review comment:
       Directly return `invoker.GetUrl().GetParam(constant.Tagkey, "") == "beijing"`.

##########
File path: cluster/router/tag/tag_router_test.go
##########
@@ -160,3 +187,187 @@ func TestTagRouterRouteNoForce(t *testing.T) {
 	invRst2 := tagRouter.Route(invokers, &u1, inv)
 	assert.Equal(t, 3, len(invRst2))
 }
+
+func TestFilterInvoker(t *testing.T) {
+	u2, e2 := common.NewURL(tagRouterTestHangZhouUrl)
+	u3, e3 := common.NewURL(tagRouterTestShangHaiUrl)
+	u4, e4 := common.NewURL(tagRouterTestBeijingUrl)
+	u5, e5 := common.NewURL(tagRouterTestEnabledBeijingUrl)
+	assert.Nil(t, e2)
+	assert.Nil(t, e3)
+	assert.Nil(t, e4)
+	assert.Nil(t, e5)
+	inv2 := NewMockInvoker(u2)
+	inv3 := NewMockInvoker(u3)
+	inv4 := NewMockInvoker(u4)
+	inv5 := NewMockInvoker(u5)
+	var invokers []protocol.Invoker
+	invokers = append(invokers, inv2, inv3, inv4, inv5)
+	filterTag := func(invoker protocol.Invoker) bool {
+		if invoker.GetUrl().GetParam(constant.Tagkey, "") == "beijing" {
+			return true
+		}
+		return false
+	}
+	res := filterInvoker(invokers, filterTag)
+	assert.Equal(t, []protocol.Invoker{inv4, inv5}, res)
+	flag := true
+	filterEnabled := func(invoker protocol.Invoker) bool {
+		if invoker.GetUrl().GetParamBool(constant.RouterEnabled, false) == flag {

Review comment:
       As above.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] codecov-commenter edited a comment on pull request #703: Ftr: add dynamic tag router

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #703:
URL: https://github.com/apache/dubbo-go/pull/703#issuecomment-672834033


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/703?src=pr&el=h1) Report
   > Merging [#703](https://codecov.io/gh/apache/dubbo-go/pull/703?src=pr&el=desc) into [develop](https://codecov.io/gh/apache/dubbo-go/commit/03bde755952c756b6d5e1875186ab5c4f875e67c&el=desc) will **decrease** coverage by `0.15%`.
   > The diff coverage is `71.15%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/703/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL)](https://codecov.io/gh/apache/dubbo-go/pull/703?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           develop     #703      +/-   ##
   ===========================================
   - Coverage    63.93%   63.77%   -0.16%     
   ===========================================
     Files          238      239       +1     
     Lines        12487    12778     +291     
   ===========================================
   + Hits          7983     8149     +166     
   - Misses        3740     3833      +93     
   - Partials       764      796      +32     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/703?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [cluster/cluster\_impl/base\_cluster\_invoker.go](https://codecov.io/gh/apache/dubbo-go/pull/703/diff?src=pr&el=tree#diff-Y2x1c3Rlci9jbHVzdGVyX2ltcGwvYmFzZV9jbHVzdGVyX2ludm9rZXIuZ28=) | `72.15% <ø> (ø)` | |
   | [cluster/loadbalance/consistent\_hash.go](https://codecov.io/gh/apache/dubbo-go/pull/703/diff?src=pr&el=tree#diff-Y2x1c3Rlci9sb2FkYmFsYW5jZS9jb25zaXN0ZW50X2hhc2guZ28=) | `90.32% <ø> (ø)` | |
   | [common/url.go](https://codecov.io/gh/apache/dubbo-go/pull/703/diff?src=pr&el=tree#diff-Y29tbW9uL3VybC5nbw==) | `65.95% <0.00%> (ø)` | |
   | [common/yaml/yaml.go](https://codecov.io/gh/apache/dubbo-go/pull/703/diff?src=pr&el=tree#diff-Y29tbW9uL3lhbWwveWFtbC5nbw==) | `86.66% <0.00%> (-13.34%)` | :arrow_down: |
   | [config/base\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/703/diff?src=pr&el=tree#diff-Y29uZmlnL2Jhc2VfY29uZmlnLmdv) | `68.12% <ø> (ø)` | |
   | [config/provider\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/703/diff?src=pr&el=tree#diff-Y29uZmlnL3Byb3ZpZGVyX2NvbmZpZy5nbw==) | `58.06% <0.00%> (ø)` | |
   | [protocol/dubbo/client.go](https://codecov.io/gh/apache/dubbo-go/pull/703/diff?src=pr&el=tree#diff-cHJvdG9jb2wvZHViYm8vY2xpZW50Lmdv) | `69.09% <ø> (ø)` | |
   | [protocol/dubbo/codec.go](https://codecov.io/gh/apache/dubbo-go/pull/703/diff?src=pr&el=tree#diff-cHJvdG9jb2wvZHViYm8vY29kZWMuZ28=) | `72.50% <ø> (ø)` | |
   | [protocol/grpc/server.go](https://codecov.io/gh/apache/dubbo-go/pull/703/diff?src=pr&el=tree#diff-cHJvdG9jb2wvZ3JwYy9zZXJ2ZXIuZ28=) | `68.42% <ø> (ø)` | |
   | [protocol/result.go](https://codecov.io/gh/apache/dubbo-go/pull/703/diff?src=pr&el=tree#diff-cHJvdG9jb2wvcmVzdWx0Lmdv) | `0.00% <ø> (ø)` | |
   | ... and [36 more](https://codecov.io/gh/apache/dubbo-go/pull/703/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/703?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/703?src=pr&el=footer). Last update [25281bf...0a475bf](https://codecov.io/gh/apache/dubbo-go/pull/703?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org