User::pingLimiter() profiles per action as well
authorAntoine Musso <hashar@free.fr>
Mon, 19 May 2014 10:45:11 +0000 (12:45 +0200)
committerAntoine Musso <hashar@free.fr>
Mon, 19 May 2014 10:45:11 +0000 (12:45 +0200)
We had an outage beginning of may that involved rate limiting of the
'renderfile-nonstandard' action.  This makes User::pingLimiter() to
record a per action profiling point in addition to the generic one, that
would let us finely graph actions being throttled.

Ref:
https://wikitech.wikimedia.org/wiki/Incident_documentation/20140503-Thumbnails#What_can_be_improved

Bug: 65477
Change-Id: Iac7930e85f7d9101663656ccb2bccdbebf908693

RELEASE-NOTES-1.24
includes/User.php

index bb8dd22..195ecef 100644 (file)
@@ -60,6 +60,8 @@ changes to languages because of Bugzilla reports.
 * The deprecated function mw.util.toggleToc was removed.
 * The Special:Search hooks SpecialSearchGo and SpecialSearchResultsAppend
   were removed as they were unused.
+* (bug 65477) User::pingLimiter() now has an additional profile point varying
+  by action being used.
 * mediawiki.util.$content no longer supports old versions of the Vector,
   Monobook, Modern and CologneBlue skins that don't yet implement the "mw-body"
   and/or "mw-body-primary" class name in their html.
index 6578341..941a405 100644 (file)
@@ -1672,6 +1672,9 @@ class User {
         * Primitive rate limits: enforce maximum actions per time period
         * to put a brake on flooding.
         *
+        * The method generates both a generic profiling point and a per action one
+        * (suffix being "-$action".
+        *
         * @note When using a shared cache like memcached, IP-address
         * last-hit counters will be shared across wikis.
         *
@@ -1698,6 +1701,7 @@ class User {
 
                global $wgMemc;
                wfProfileIn( __METHOD__ );
+               wfProfileIn( __METHOD__ . '-' . $action );
 
                $limits = $wgRateLimits[$action];
                $keys = array();
@@ -1776,6 +1780,7 @@ class User {
                        }
                }
 
+               wfProfileOut( __METHOD__ . '-' . $action );
                wfProfileOut( __METHOD__ );
                return $triggered;
        }