aboutsummaryrefslogtreecommitdiffstats
path: root/includes/db
diff options
context:
space:
mode:
authorTim Starling <tstarling@wikimedia.org>2022-07-19 09:54:21 +1000
committerKrinkle <krinkle@fastmail.com>2022-07-20 05:36:06 +0000
commit0c92bc8a96fb23a682d8640ba8b5b5076c28c19c (patch)
tree82ea0ea6222d998025ee9e6829723a1534e40bfb /includes/db
parent042b53807b08340eb1afed9fb495b9dfdf3ca012 (diff)
downloadmediawikicore-0c92bc8a96fb23a682d8640ba8b5b5076c28c19c.tar.gz
mediawikicore-0c92bc8a96fb23a682d8640ba8b5b5076c28c19c.zip
rdbms: Instrument LoadBalancer with statsd metrics
* Export the LoadMonitor weight metric to statsd on each global cache miss. * Export the replication lag at the same time. This can replace the getLagTimes.php cron job and should eliminate the sawtooth effect seen in the cron job exports, which is presumably due to the offset between cron job start time and heartbeat time. It should also work around the bug which causes s3 to be missing. Also: * Fix a log message in TransactionProfiler. actualSeconds -> actual since this log message is used for counts as well as time. Bug: T313004 Change-Id: I61e45870d750019ed2c92f45b2f8b9c33a7e7d65
Diffstat (limited to 'includes/db')
-rw-r--r--includes/db/MWLBFactory.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/includes/db/MWLBFactory.php b/includes/db/MWLBFactory.php
index ebff9efd1a02..7fbcd2873b06 100644
--- a/includes/db/MWLBFactory.php
+++ b/includes/db/MWLBFactory.php
@@ -21,6 +21,7 @@
* @ingroup Database
*/
+use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface;
use MediaWiki\Config\ServiceOptions;
use MediaWiki\Logger\LoggerFactory;
use MediaWiki\MainConfigNames;
@@ -75,6 +76,7 @@ abstract class MWLBFactory {
* @param BagOStuff $srvCache
* @param WANObjectCache $wanCache
* @param CriticalSectionProvider $csProvider
+ * @param StatsdDataFactoryInterface $statsdDataFactory
* @return array
* @internal For use with service wiring
*/
@@ -85,7 +87,8 @@ abstract class MWLBFactory {
BagOStuff $cpStash,
BagOStuff $srvCache,
WANObjectCache $wanCache,
- CriticalSectionProvider $csProvider
+ CriticalSectionProvider $csProvider,
+ StatsdDataFactoryInterface $statsdDataFactory
) {
$options->assertRequiredOptions( self::APPLY_DEFAULT_CONFIG_OPTIONS );
@@ -107,6 +110,7 @@ abstract class MWLBFactory {
'perfLogger' => LoggerFactory::getInstance( 'DBPerformance' ),
'errorLogger' => [ MWExceptionHandler::class, 'logException' ],
'deprecationLogger' => [ static::class, 'logDeprecation' ],
+ 'statsdDataFactory' => $statsdDataFactory,
'cliMode' => $options->get( 'CommandLineMode' ),
'readOnlyReason' => $readOnlyMode->getReason(),
'defaultGroup' => $options->get( MainConfigNames::DBDefaultGroup ),