call counter prefix

This commit is contained in:
simonredfern 2025-12-31 06:06:07 +01:00
parent 3e884478df
commit 5f5409e34a
3 changed files with 4 additions and 3 deletions

View File

@ -129,7 +129,7 @@ object Constant extends MdcLoggable {
final val SHOW_USED_CONNECTOR_METHODS: Boolean = APIUtil.getPropsAsBoolValue(s"show_used_connector_methods", false)
// Rate Limiting Cache Prefixes
final val CALL_COUNTER_PREFIX = "rl_counter_"
final val CALL_COUNTER_PREFIX = "call_counter_"
final val RATE_LIMIT_ACTIVE_PREFIX = "rl_active_"
final val RATE_LIMIT_ACTIVE_CACHE_TTL: Int = APIUtil.getPropsValue("rateLimitActive.cache.ttl.seconds", "3600").toInt

View File

@ -5,6 +5,7 @@ import code.ratelimiting.{RateLimiting, RateLimitingDI}
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global
import code.api.{APIFailureNewStyle, JedisMethod}
import code.api.Constant._
import code.api.cache.Redis
import code.api.util.APIUtil.fullBoxOrException
import code.api.util.ErrorMessages.TooManyRequests
@ -192,7 +193,7 @@ object RateLimitingUtil extends MdcLoggable {
RateLimitCounterState(calls, normalizedTtl, status)
}
private def createUniqueKey(consumerKey: String, period: LimitCallPeriod) = "rl_counter_" + consumerKey + "_" + RateLimitingPeriod.toString(period)
private def createUniqueKey(consumerKey: String, period: LimitCallPeriod) = CALL_COUNTER_PREFIX + consumerKey + "_" + RateLimitingPeriod.toString(period)
private def underConsumerLimits(consumerKey: String, period: LimitCallPeriod, limit: Long): Boolean = {
if (useConsumerLimits) {

View File

@ -1059,7 +1059,7 @@ trait APIMethods600 {
CacheNamespacesJsonV600(
namespaces = List(
CacheNamespaceJsonV600(
prefix = "rl_counter_",
prefix = "call_counter_",
description = "Rate limiting counters per consumer and time period",
ttl_seconds = "varies",
category = "Rate Limiting",