Skip to content

Commit

Permalink
hide
Browse files Browse the repository at this point in the history
Signed-off-by: Takeshi Yoneda <[email protected]>
  • Loading branch information
mathetake authored and zirain committed Dec 27, 2024
1 parent a447e40 commit d1b3de3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
4 changes: 4 additions & 0 deletions api/v1alpha1/ratelimit_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ type RateLimitRule struct {
// enough capacity, the request is rate limited.
//
// +optional
// +notImplementedHide
RequestHitsAddend *RateLimitHitsAddend `json:"requestHitsAddend,omitempty"`
// ResponseHitsAddend specifies the number to reduce the rate limit counters
// after the response is sent back to the client or the request stream is closed.
Expand All @@ -115,6 +116,7 @@ type RateLimitRule struct {
// Currently, this is only supported for HTTP Global Rate Limits.
//
// +optional
// +notImplementedHide
ResponseHitsAddend *RateLimitHitsAddend `json:"responseHitsAddend,omitempty"`
}

Expand All @@ -135,6 +137,7 @@ type RateLimitHitsAddend struct {
// Number specifies the fixed usage number to reduce the rate limit counters.
//
// +optional
// +notImplementedHide
Number *uint64 `json:"number,omitempty"`
// Format specifies the format of the usage number. See the Envoy documentation for the supported format which
// is the same as the access log format:
Expand All @@ -145,6 +148,7 @@ type RateLimitHitsAddend struct {
// Another example is `%BYTES_RECEIVED%` which will retrieve the usage number from the bytes received by the client.
//
// +optional
// +notImplementedHide
Format *string `json:"format,omitempty"`
}

Expand Down
4 changes: 0 additions & 4 deletions site/content/en/latest/api/extension_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -3376,8 +3376,6 @@ _Appears in:_

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `number` | _integer_ | false | Number specifies the fixed usage number to reduce the rate limit counters. |
| `format` | _string_ | false | Format specifies the format of the usage number. See the Envoy documentation for the supported format which<br />is the same as the access log format:<br />https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage#config-access-log-format<br /><br />For example `%DYNAMIC_METADATA(com.test.my_filter:test_key)%"` will retrieve the usage number from the<br />`com.test.my_filter` filter metadata namespace with the key `test_key`.<br />Another example is `%BYTES_RECEIVED%` which will retrieve the usage number from the bytes received by the client. |


#### RateLimitMetrics
Expand Down Expand Up @@ -3438,8 +3436,6 @@ _Appears in:_
| --- | --- | --- | --- |
| `clientSelectors` | _[RateLimitSelectCondition](#ratelimitselectcondition) array_ | false | ClientSelectors holds the list of select conditions to select<br />specific clients using attributes from the traffic flow.<br />All individual select conditions must hold True for this rule<br />and its limit to be applied.<br /><br />If no client selectors are specified, the rule applies to all traffic of<br />the targeted Route.<br /><br />If the policy targets a Gateway, the rule applies to each Route of the Gateway.<br />Please note that each Route has its own rate limit counters. For example,<br />if a Gateway has two Routes, and the policy has a rule with limit 10rps,<br />each Route will have its own 10rps limit. |
| `limit` | _[RateLimitValue](#ratelimitvalue)_ | true | Limit holds the rate limit values.<br />This limit is applied for traffic flows when the selectors<br />compute to True, causing the request to be counted towards the limit.<br />The limit is enforced and the request is ratelimited, i.e. a response with<br />429 HTTP status code is sent back to the client when<br />the selected requests have reached the limit. |
| `requestHitsAddend` | _[RateLimitHitsAddend](#ratelimithitsaddend)_ | false | RequestHitsAddend specifies the number to reduce the rate limit counters<br />on the request path. If the addend is not specified, the default behavior<br />is to reduce the rate limit counters by 1.<br /><br />When Envoy receives a request that matches the rule, it tries to reduce the<br />rate limit counters by the specified number. If the counter doesn't have<br />enough capacity, the request is rate limited. |
| `responseHitsAddend` | _[RateLimitHitsAddend](#ratelimithitsaddend)_ | false | ResponseHitsAddend specifies the number to reduce the rate limit counters<br />after the response is sent back to the client or the request stream is closed.<br /><br />The addend is used to reduce the rate limit counters for the matching requests.<br />Since the reduction happens after the request stream is complete, the rate limit<br />won't be enforced for the current request, but for the subsequent matching requests.<br /><br />This is optional and if not specified, the rate limit counters are not reduced<br />on the response path.<br /><br />Currently, this is only supported for HTTP Global Rate Limits. |


#### RateLimitSelectCondition
Expand Down
4 changes: 0 additions & 4 deletions site/content/zh/latest/api/extension_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -3376,8 +3376,6 @@ _Appears in:_

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `number` | _integer_ | false | Number specifies the fixed usage number to reduce the rate limit counters. |
| `format` | _string_ | false | Format specifies the format of the usage number. See the Envoy documentation for the supported format which<br />is the same as the access log format:<br />https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage#config-access-log-format<br /><br />For example `%DYNAMIC_METADATA(com.test.my_filter:test_key)%"` will retrieve the usage number from the<br />`com.test.my_filter` filter metadata namespace with the key `test_key`.<br />Another example is `%BYTES_RECEIVED%` which will retrieve the usage number from the bytes received by the client. |


#### RateLimitMetrics
Expand Down Expand Up @@ -3438,8 +3436,6 @@ _Appears in:_
| --- | --- | --- | --- |
| `clientSelectors` | _[RateLimitSelectCondition](#ratelimitselectcondition) array_ | false | ClientSelectors holds the list of select conditions to select<br />specific clients using attributes from the traffic flow.<br />All individual select conditions must hold True for this rule<br />and its limit to be applied.<br /><br />If no client selectors are specified, the rule applies to all traffic of<br />the targeted Route.<br /><br />If the policy targets a Gateway, the rule applies to each Route of the Gateway.<br />Please note that each Route has its own rate limit counters. For example,<br />if a Gateway has two Routes, and the policy has a rule with limit 10rps,<br />each Route will have its own 10rps limit. |
| `limit` | _[RateLimitValue](#ratelimitvalue)_ | true | Limit holds the rate limit values.<br />This limit is applied for traffic flows when the selectors<br />compute to True, causing the request to be counted towards the limit.<br />The limit is enforced and the request is ratelimited, i.e. a response with<br />429 HTTP status code is sent back to the client when<br />the selected requests have reached the limit. |
| `requestHitsAddend` | _[RateLimitHitsAddend](#ratelimithitsaddend)_ | false | RequestHitsAddend specifies the number to reduce the rate limit counters<br />on the request path. If the addend is not specified, the default behavior<br />is to reduce the rate limit counters by 1.<br /><br />When Envoy receives a request that matches the rule, it tries to reduce the<br />rate limit counters by the specified number. If the counter doesn't have<br />enough capacity, the request is rate limited. |
| `responseHitsAddend` | _[RateLimitHitsAddend](#ratelimithitsaddend)_ | false | ResponseHitsAddend specifies the number to reduce the rate limit counters<br />after the response is sent back to the client or the request stream is closed.<br /><br />The addend is used to reduce the rate limit counters for the matching requests.<br />Since the reduction happens after the request stream is complete, the rate limit<br />won't be enforced for the current request, but for the subsequent matching requests.<br /><br />This is optional and if not specified, the rate limit counters are not reduced<br />on the response path.<br /><br />Currently, this is only supported for HTTP Global Rate Limits. |


#### RateLimitSelectCondition
Expand Down

0 comments on commit d1b3de3

Please sign in to comment.