Gergő Tisza has uploaded a new change for review.
https://gerrit.wikimedia.org/r/226640
Change subject: Count API and hook calls, with 1:1000 sampling
......................................................................
Count API and hook calls, with 1:1000 sampling
Re-adds I6f807adc9cbf71c5d7b83c7eec43965dce1d2a16 and
Ic04daf475b936b942833362c7a979dde671b3ef4 (reverted in
35ccd9c2fe058ed76be905d9efe06c31c11fd696) with 1:1000 sampling
to avoid swamping the statsd hosts.
Also fixes query module logging.
Bug: T102079
Bug: T106450
Change-Id: I8b9366407c0d1713790d08e69aaa518130f01977
---
M includes/Hooks.php
M includes/api/ApiMain.php
M includes/api/ApiQuery.php
3 files changed, 5 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/40/226640/1
diff --git a/includes/Hooks.php b/includes/Hooks.php
index 036d65c..a9c842b 100644
--- a/includes/Hooks.php
+++ b/includes/Hooks.php
@@ -135,6 +135,7 @@
* returning null) is equivalent to returning true.
*/
public static function run( $event, array $args = array(),
$deprecatedVersion = null ) {
+ RequestContext::getMain()->getStats()->increment( 'hooks.' .
$event )->setSampleRate( 0.001 );
foreach ( self::getHandlers( $event ) as $hook ) {
// Turn non-array values into an array. (Can't use
casting because of objects.)
if ( !is_array( $hook ) ) {
diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php
index f2059d7..66e1a55 100644
--- a/includes/api/ApiMain.php
+++ b/includes/api/ApiMain.php
@@ -1090,6 +1090,8 @@
$this->checkAsserts( $params );
// Execute
+ $this->getContext()->getStats()->increment(
+ 'api.modules.' . strtr( $module->getModulePath(), '+',
'.' ) )->getSampleRate( 0.001 );
$module->execute();
Hooks::run( 'APIAfterExecute', array( &$module ) );
diff --git a/includes/api/ApiQuery.php b/includes/api/ApiQuery.php
index 5378e92..5df21e6 100644
--- a/includes/api/ApiQuery.php
+++ b/includes/api/ApiQuery.php
@@ -285,6 +285,8 @@
$cacheMode, $module->getCacheMode( $params ) );
$module->execute();
Hooks::run( 'APIQueryAfterExecute', array( &$module ) );
+ $this->getContext()->getStats()->increment(
+ 'api.modules.' . strtr(
$module->getModulePath(), '+', '.' ) )->getSampleRate( 0.001 );
}
// Set the cache mode
--
To view, visit https://gerrit.wikimedia.org/r/226640
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8b9366407c0d1713790d08e69aaa518130f01977
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Gergő Tisza <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits