From c6d2946a04cac77af05f73311d166e9ee23cbe33 Mon Sep 17 00:00:00 2001 From: yavlasov Date: Mon, 16 Mar 2026 11:15:32 -0400 Subject: [PATCH] Add debug logging for quota values Signed-off-by: yavlasov --- src/limiter/base_limiter.go | 2 +- src/service/ratelimit.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/limiter/base_limiter.go b/src/limiter/base_limiter.go index 6aec1ac8a..3ee5ce8e5 100644 --- a/src/limiter/base_limiter.go +++ b/src/limiter/base_limiter.go @@ -100,7 +100,7 @@ func (this *BaseRateLimiter) GetResponseDescriptorStatus(key string, limitInfo * // The nearLimitThreshold is the number of requests that can be made before hitting the nearLimitRatio. // We need to know it in both the OK and OVER_LIMIT scenarios. limitInfo.nearLimitThreshold = uint64(math.Floor(float64(float32(limitInfo.overLimitThreshold) * this.nearLimitRatio))) - logger.Debugf("cache key: %s current: %d", key, limitInfo.limitAfterIncrease) + logger.Debugf("cache key: %s current: %d limit: %d", key, limitInfo.limitAfterIncrease, limitInfo.overLimitThreshold) if limitInfo.limitAfterIncrease > limitInfo.overLimitThreshold { isOverLimit = true responseDescriptorStatus = this.generateResponseDescriptorStatus(pb.RateLimitResponse_OVER_LIMIT, diff --git a/src/service/ratelimit.go b/src/service/ratelimit.go index 559b49533..313dc7b77 100644 --- a/src/service/ratelimit.go +++ b/src/service/ratelimit.go @@ -144,10 +144,11 @@ func (this *service) constructLimitsToCheck(request *pb.RateLimitRequest, ctx co logger.Debugf("descriptor is unlimited, not passing to the cache") } else { logger.Debugf( - "applying limit: %d requests per %s, shadow_mode: %t", + "applying limit: %d requests per %s, shadow_mode: %t, quota: %t", limitsToCheck[i].Limit.RequestsPerUnit, limitsToCheck[i].Limit.Unit.String(), limitsToCheck[i].ShadowMode, + limitsToCheck[i].QuotaMode, ) } } @@ -195,6 +196,7 @@ func (this *service) shouldRateLimitWorker( assert.Assert(len(limitsToCheck) == len(request.Descriptors)) responseDescriptorStatuses := this.cache.DoLimit(ctx, request, limitsToCheck) + logger.Debugf("descriptor statuses: %+v", responseDescriptorStatuses) assert.Assert(len(limitsToCheck) == len(responseDescriptorStatuses)) response := &pb.RateLimitResponse{}