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 2022/10/24 13:00:43 UTC

[GitHub] [dubbo-go-pixiu] maxingg opened a new pull request, #507: fix: traffic filter fix weight strategy and error handle within Apply method.

maxingg opened a new pull request, #507:
URL: https://github.com/apache/dubbo-go-pixiu/pull/507

   **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 #402
   


-- 
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: notifications-unsubscribe@dubbo.apache.org

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-pixiu] baerwang commented on pull request #507: fix: traffic filter fix weight strategy and error handle within Apply method.

Posted by GitBox <gi...@apache.org>.
baerwang commented on PR #507:
URL: https://github.com/apache/dubbo-go-pixiu/pull/507#issuecomment-1289167350

   pls fix ci(lint)


-- 
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: notifications-unsubscribe@dubbo.apache.org

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-pixiu] baerwang commented on a diff in pull request #507: fix: traffic filter fix weight strategy and error handle within Apply method.

Posted by GitBox <gi...@apache.org>.
baerwang commented on code in PR #507:
URL: https://github.com/apache/dubbo-go-pixiu/pull/507#discussion_r1003418640


##########
pixiu/pkg/filter/traffic/traffic.go:
##########
@@ -89,42 +94,79 @@ func (factory *FilterFactory) Config() interface{} {
 }
 
 func (factory *FilterFactory) Apply() error {
+	var (
+		router string
+		up     int
+	)
+
+	for _, cluster := range factory.cfg.Traffics {
+		up = 0
+		router = cluster.Router
+		if len(factory.rulesMap[router]) != 0 {
+			lastCeil := factory.rulesMap[router][len(factory.rulesMap[router])-1].weightCeil
+			if lastCeil != -1 {
+				up = lastCeil
+			}
+		}
+
+		wp := &ClusterWrapper{
+			Cluster:     cluster,
+			weightCeil:  -1,
+			weightFloor: -1,
+		}
+		if cluster.CanaryByHeader != "" {
+			if _, ok := factory.record[cluster.CanaryByHeader]; ok {
+				return errors.New("duplicate canary-by-header values")
+			} else {
+				factory.record[cluster.CanaryByHeader] = struct{}{}
+				wp.header = cluster.CanaryByHeader
+			}
+		}
+		if cluster.CanaryWeight > 0 && cluster.CanaryWeight <= 100 {
+			if up+cluster.CanaryWeight > 100 {
+				return errors.New(fmt.Sprintf("[dubbo-go-pixiu] clusters' weight sum more than 100 in %v service!", cluster.Router))

Review Comment:
   use **fmt.Errorf**
   



-- 
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: notifications-unsubscribe@dubbo.apache.org

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-pixiu] AlbumenJ merged pull request #507: fix: traffic filter fix weight strategy and error handle within Apply method.

Posted by GitBox <gi...@apache.org>.
AlbumenJ merged PR #507:
URL: https://github.com/apache/dubbo-go-pixiu/pull/507


-- 
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: notifications-unsubscribe@dubbo.apache.org

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