The `type` log event attribute is used in Wikimedia production logging
to categorize log events by source (e.g. 'mediawiki', 'restbase', etc).
Adding a `type` key to the logging context overwrites the default value
of 'mediawiki'. Rename the key to `throttle` in the context and the
message template.
Change-Id: Ic274159774e43a8749f83c850fff7897956cf377
$this->cache->incr( $throttleKey );
} else { // throttled
$this->logRejection( [
- 'type' => $this->type,
+ 'throttle' => $this->type,
'index' => $index,
'ip' => $ipKey,
'username' => $username,
}
protected function logRejection( array $context ) {
- $logMsg = 'Throttle {type} hit, throttled for {expiry} seconds due to {count} attempts '
+ $logMsg = 'Throttle {throttle} hit, throttled for {expiry} seconds due to {count} attempts '
. 'from username {username} and IP {ip}';
// If we are hitting a throttle for >= warningLimit attempts, it is much more likely to be
->setMethods( [ 'log' ] )
->getMockForAbstractClass();
$logger->expects( $this->once() )->method( 'log' )->with( $this->anything(), $this->anything(), [
- 'type' => 'custom',
+ 'throttle' => 'custom',
'index' => 0,
'ip' => '1.2.3.4',
'username' => 'SomeUser',