Skip to content

Commit ae44ab6

Browse files
authored
Add debug logging for quota values (#1089)
1 parent 37bbc6b commit ae44ab6

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/limiter/base_limiter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func (this *BaseRateLimiter) GetResponseDescriptorStatus(key string, limitInfo *
100100
// The nearLimitThreshold is the number of requests that can be made before hitting the nearLimitRatio.
101101
// We need to know it in both the OK and OVER_LIMIT scenarios.
102102
limitInfo.nearLimitThreshold = uint64(math.Floor(float64(float32(limitInfo.overLimitThreshold) * this.nearLimitRatio)))
103-
logger.Debugf("cache key: %s current: %d", key, limitInfo.limitAfterIncrease)
103+
logger.Debugf("cache key: %s current: %d limit: %d", key, limitInfo.limitAfterIncrease, limitInfo.overLimitThreshold)
104104
if limitInfo.limitAfterIncrease > limitInfo.overLimitThreshold {
105105
isOverLimit = true
106106
responseDescriptorStatus = this.generateResponseDescriptorStatus(pb.RateLimitResponse_OVER_LIMIT,

src/service/ratelimit.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,11 @@ func (this *service) constructLimitsToCheck(request *pb.RateLimitRequest, ctx co
144144
logger.Debugf("descriptor is unlimited, not passing to the cache")
145145
} else {
146146
logger.Debugf(
147-
"applying limit: %d requests per %s, shadow_mode: %t",
147+
"applying limit: %d requests per %s, shadow_mode: %t, quota: %t",
148148
limitsToCheck[i].Limit.RequestsPerUnit,
149149
limitsToCheck[i].Limit.Unit.String(),
150150
limitsToCheck[i].ShadowMode,
151+
limitsToCheck[i].QuotaMode,
151152
)
152153
}
153154
}
@@ -195,6 +196,7 @@ func (this *service) shouldRateLimitWorker(
195196
assert.Assert(len(limitsToCheck) == len(request.Descriptors))
196197

197198
responseDescriptorStatuses := this.cache.DoLimit(ctx, request, limitsToCheck)
199+
logger.Debugf("descriptor statuses: %+v", responseDescriptorStatuses)
198200
assert.Assert(len(limitsToCheck) == len(responseDescriptorStatuses))
199201

200202
response := &pb.RateLimitResponse{}

0 commit comments

Comments
 (0)