Skip to content

Commit 16e366c

Browse files
Merge pull request #292069 from nimakamoosi/nimak/fix/rate-limit-increment-expressions
fix(rate-limit) detail behavior change of increment attributes with expression
2 parents b02a945 + 77c268f commit 16e366c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

articles/api-management/rate-limit-by-key-policy.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ To understand the difference between rate limits and quotas, [see Rate limits an
4444
| ------------------- | ----------------------------------------------------------------------------------------------------- | -------- | ------- |
4545
| calls | The maximum total number of calls allowed for the key value during the time interval specified in the `renewal-period`. Policy expressions are allowed. | Yes | N/A |
4646
| counter-key | The key to use for the rate limit policy. For each key value, a single counter is used for all scopes at which the policy is configured. Policy expressions are allowed. | Yes | N/A |
47-
| increment-condition | The Boolean expression specifying if the request should be counted towards the rate (`true`). Policy expressions are allowed. | No | N/A |
48-
| increment-count | The number by which the counter is increased per request. Policy expressions are allowed. | No | 1 |
49-
| renewal-period | The length in seconds of the sliding window during which the number of allowed requests should not exceed the value specified in `calls`. Maximum allowed value: 300 seconds. Policy expressions are allowed. | Yes | N/A |
47+
| increment-condition | The Boolean expression specifying if the request should be counted towards the rate (`true`). Policy expressions are allowed but will postpone evaluation and counter increment actions to end of outbound pipeline. | No | N/A |
48+
| increment-count | The number by which the counter is increased per request. Policy expressions are allowed but will postpone evaluation and counter increment to end of outbound pipeline. | No | 1 |
49+
| renewal-period | The length in seconds of the sliding window during which the number of allowed requests should not exceed the value specified in `calls`. Maximum allowed value: 300 seconds. Policy expressions are allowed. | Yes | N/A |
5050
| retry-after-header-name | The name of a custom response header whose value is the recommended retry interval in seconds after the specified call rate is exceeded for the key value. Policy expressions aren't allowed. | No | `Retry-After` |
5151
| retry-after-variable-name | The name of a policy expression variable that stores the recommended retry interval in seconds after the specified call rate is exceeded for the key value. Policy expressions aren't allowed. | No | N/A |
5252
| remaining-calls-header-name | The name of a response header whose value after each policy execution is the number of remaining calls allowed for the key value in the time interval specified in the `renewal-period`. Policy expressions aren't allowed. | No | N/A |
@@ -63,6 +63,7 @@ To understand the difference between rate limits and quotas, [see Rate limits an
6363

6464
* [!INCLUDE [api-management-rate-limit-key-scope](../../includes/api-management-rate-limit-key-scope.md)]
6565
* [!INCLUDE [api-management-self-hosted-gateway-rate-limit](../../includes/api-management-self-hosted-gateway-rate-limit.md)] [Learn more](how-to-self-hosted-gateway-on-kubernetes-in-production.md#request-throttling)
66+
* When `increment-condition` or `increment-count` are defined using expressions, evaluation and increment of rate limit counter are postponed to end of outbound pipeline to allow for policy expressions based on the reponse. Limit exceeded condition is not evaluated at the same time in this case and will be evaluated on next incoming call. This leads to cases where `429 Too Many Requests` status code is returned 1 call later than usual.
6667

6768

6869
## Example

0 commit comments

Comments
 (0)