jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/325892 )
Change subject: Record totals in categories in statsd
......................................................................
Record totals in categories in statsd
For historical purposes so we can see new errors being added/fixed.
Bug: T152664
Change-Id: Icec62d236351e43ec397ac448805ab16131c943c
---
M extension.json
M includes/RecordLintJob.php
2 files changed, 30 insertions(+), 1 deletion(-)
Approvals:
Addshore: Looks good to me, but someone else must approve
jenkins-bot: Verified
Arlolra: Looks good to me, approved
diff --git a/extension.json b/extension.json
index f00ede7..42b7614 100644
--- a/extension.json
+++ b/extension.json
@@ -64,7 +64,8 @@
},
"LinterSubmitterWhitelist": {
"127.0.0.1": true
- }
+ },
+ "LinterStatsdSampleFactor": false
},
"manifest_version": 1
}
diff --git a/includes/RecordLintJob.php b/includes/RecordLintJob.php
index 518ea42..ab2eeab 100644
--- a/includes/RecordLintJob.php
+++ b/includes/RecordLintJob.php
@@ -21,6 +21,7 @@
namespace MediaWiki\Linter;
use Job;
+use MediaWiki\MediaWikiServices;
use Title;
class RecordLintJob extends Job {
@@ -62,7 +63,34 @@
}
$lintDb->setForPage( $toSet );
+ $this->updateStats( $lintDb );
+
return true;
}
+ /**
+ * Send stats to statsd
+ *
+ * @param Database $lintDb
+ */
+ protected function updateStats( Database $lintDb ) {
+ global $wgLinterStatsdSampleFactor;
+
+ if ( $wgLinterStatsdSampleFactor === false ) {
+ // Not enabled at all
+ return;
+ } elseif ( mt_rand( 1, $wgLinterStatsdSampleFactor ) != 1 ) {
+ return;
+ }
+
+ $totals = $lintDb->getTotals();
+
+ $stats =
MediaWikiServices::getInstance()->getStatsdDataFactory();
+ foreach ( $totals as $name => $count ) {
+ $stats->gauge( "linter.category.$name", $count );
+ }
+
+ $stats->gauge( "linter.totals", array_sum( $totals ) );
+ }
+
}
--
To view, visit https://gerrit.wikimedia.org/r/325892
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Icec62d236351e43ec397ac448805ab16131c943c
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/Linter
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Arlolra <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits