in pan-domain-auth-verification/src/main/scala/com/gu/pandomainauth/internal/NonActiveKeyMonitoring.scala [14:24]
def monitor(usedKey: KeyHashId, activeKey: KeyHashId): Unit = {
val isActive = usedKey == activeKey
activeFrequency.increment(isActive)
keyFrequency.increment(usedKey)
if (!isActive) { // an accepted key, but not the _current_ one - either old or new...
if (rateLimiter.tryAcquire()) {
logger.warn(s"NON_ACTIVE_KEY_USED (used=$usedKey, active=$activeKey): active_freq=${activeFrequency.snapshot()} key_freq=${keyFrequency.snapshot()}")
}
}
}