shenyu icon indicating copy to clipboard operation
shenyu copied to clipboard

Support boolean expression rule for gray release

Open tuohai666 opened this issue 5 years ago • 9 comments

For now there are 4 matching rules: match, =, regEx, like. A new customized rule with parameters will make gray release more flexible. The previous discussion can be found at https://github.com/dromara/soul/issues/1288 image

I suggest that we add a boolean expression rule, if the expression is true then the query will be routed to the new version.

The provision may like:

  1. Set the parameter(from URI or Header), like 'user_id'.
  2. Set the expression, like ${user_id}%5=0 , ${user_id} in (1,2,3)

With this rule, users can simply control the new version proportion by adjust the expression instead of design the URI or Header.

Maybe we could use groovy script parse the expression, or something else.

Tasks list:

  • [x] Support SpEL condition
  • [x] Support Groovy condition

tuohai666 avatar Apr 21 '21 09:04 tuohai666

The groovy script is more flexible

zhaiweij avatar Apr 21 '21 09:04 zhaiweij

groovy script

onlyonezhongjinhui avatar Apr 21 '21 09:04 onlyonezhongjinhui

The groovy script is more flexible, but user shoud be programmer .we need to consider the cost of study.

zendwang avatar Apr 21 '21 10:04 zendwang

The groovy script is more flexible, but user shoud be programmer .we need to consider the cost of study.

Agree. I wonder how to parse a common expression, any suggestions?

tuohai666 avatar Apr 21 '21 10:04 tuohai666

Spring Expression Language (SpEL)

zendwang avatar Apr 21 '21 10:04 zendwang

Spring Expression Language (SpEL)

good idea

yu199195 avatar Apr 21 '21 10:04 yu199195

The groovy script is more flexible

good idea

yu199195 avatar Apr 21 '21 10:04 yu199195

groovy script + SpEL ?

zhaiweij avatar Apr 21 '21 11:04 zhaiweij

groovy script + SpEL ?

the two strategy

yu199195 avatar Apr 21 '21 12:04 yu199195