File tree Expand file tree Collapse file tree 3 files changed +12
-4
lines changed
Expand file tree Collapse file tree 3 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -97,10 +97,9 @@ descriptors:
9797` ` `
9898
9999Each descriptor in a descriptor list must have a key. It can also optionally have a value to enable a more specific
100- match. The "rate_limit" block is optional and if present sets up an actual rate limit rule. See below for how the rule
101- is defined. The reason a rule might not be present is typically if a descriptor is a container for a 2nd level
102- descriptor list. Each descriptor can optionally contain a nested descriptor list that allows for more complex matches
103- and rate limit scenarios.
100+ match. The "rate_limit" block is optional and if present sets up an actual rate limit rule. See below for how the
101+ rule is defined. If the rate limit is not present and there are no nested descriptors, then the descriptor is
102+ effectively whitelisted. Otherwise, nested descriptors allow more complex matching and rate limiting scenarios.
104103
105104### Rate limit definition
106105
Original file line number Diff line number Diff line change @@ -31,6 +31,10 @@ descriptors:
3131 unit : minute
3232 requests_per_unit : 30
3333
34+ # First level override with no limit. This effectively whitelists the value.
35+ - key : key2
36+ value : value3
37+
3438 - key : key3
3539 rate_limit :
3640 unit : hour
Original file line number Diff line number Diff line change @@ -100,6 +100,11 @@ func TestBasicConfig(t *testing.T) {
100100 assert .EqualValues (1 , stats .NewCounter ("test-domain.key2_value2.over_limit" ).Value ())
101101 assert .EqualValues (1 , stats .NewCounter ("test-domain.key2_value2.near_limit" ).Value ())
102102
103+ rl = rlConfig .GetLimit (
104+ nil , "test-domain" ,
105+ & pb.RateLimitDescriptor {[]* pb.RateLimitDescriptor_Entry {{"key2" , "value3" }}})
106+ assert .Nil (rl )
107+
103108 rl = rlConfig .GetLimit (
104109 nil , "test-domain" ,
105110 & pb.RateLimitDescriptor {[]* pb.RateLimitDescriptor_Entry {{"key3" , "foo" }}})
You can’t perform that action at this time.
0 commit comments