Skip to content

Commit

Permalink
Add more comments
Browse files Browse the repository at this point in the history
Signed-off-by: Takeshi Yoneda <[email protected]>
  • Loading branch information
mathetake committed Dec 11, 2024
1 parent a02e932 commit 6598d44
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ message RateLimit {
// This is useful when the rate limit budget needs to reflect the response context that is not available
// on the request path.
//
// On the stream completion, the filter will reuse the exact same descriptors matched during the request path.
// In other words, the descriptors are not recalculated on the stream completion, but the rate limit requests
// are sent with the same descriptors as the original request sent during the request path.
// For example, request header matching descriptors are available on the stream completion.
//
// For example, let's say the upstream service calculates the usage statistics, returns them in the response body
// and we want to utilize these numbers to apply the rate limit action for the subsequent requests.
// Combined with another filter that can set ``envoy.ratelimit.hits_addend`` based on the response (e.g. Lua filter),
Expand Down
1 change: 0 additions & 1 deletion source/extensions/filters/http/ratelimit/ratelimit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ void Filter::initiateCall(const Http::RequestHeaderMap& headers) {

void Filter::makeRateLimitRequest() {
if (!descriptors_.empty()) {
// TODO: Make addend configirable via substituion command.
const StreamInfo::UInt32Accessor* hits_addend_filter_state =
callbacks_->streamInfo().filterState()->getDataReadOnly<StreamInfo::UInt32Accessor>(
HitsAddendFilterStateKey);
Expand Down

0 comments on commit 6598d44

Please sign in to comment.