-
Notifications
You must be signed in to change notification settings - Fork 438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: hotspot rule add paramKey; #376
Conversation
721845c
to
ffa0195
Compare
Codecov Report
@@ Coverage Diff @@
## master #376 +/- ##
==========================================
- Coverage 51.42% 51.33% -0.09%
==========================================
Files 70 70
Lines 4331 4356 +25
==========================================
+ Hits 2227 2236 +9
- Misses 1806 1818 +12
- Partials 298 302 +4
Continue to review full report at Codecov.
|
chore:ParamKey add supplementary explanation chore:adjust the order of extraction parameters, give priority to paramkey, and avoid the problem of paramIndex default value 0;update test unit
ffa0195
to
f33b480
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
In the hotspot parameter rule, ParamKey is added to cooperate with the context attachments map to quickly specify the value that requires hotspot current limit from a large number of key-value pairs.
(#360)
Describe what this PR does / why we need it
It is convenient to specify hot spot parameters in hot spot current limiting rules. For example, there are a lot of data for system parameters, calibration parameters in header, and business parameters, and the parameters required by different businesses are different. It is very convenient to add all the data into ctx.attachments and specify the key in the rules.
Does this pull request fix one issue?
This time pr has added ParamKey, and modified the corresponding unit test and example.
Describe how you did it
ParamKey is added to the rule; trafficShaper also implements the extractArg interface correspondingly, which can be used with the existing paramIndex to easily specify hotspot parameters.
Describe how to verify it
Verified in unit test and example
Special notes for reviews
ParamKey can be considered as []string, so that users can specify hotspot rules flexibly in addition to specifying a single parameter.
For example, ParamKey=[]string{"uid","merchant_id"} This allows uid and merchant_id to be used as joint parameters as hot spots.