Page MenuHomePhabricator

Linter: provide graphs of error category counts via statsd
Open, MediumPublic

Description

	/**
	 * 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 ) );
	}

What's a good value for $wgLinterStatsdSampleFactor? That code path is going to be called about once per edit.

Then, how can we get the data out of statsd? I know there's a JSON API we can call, and then probably some integration with the Graph extension to display it on Special:LintErrors or something.

Event Timeline

Arlolra triaged this task as Medium priority.Aug 18 2023, 9:13 PM
Arlolra moved this task from Backlog to Linter-UI on the MediaWiki-extensions-Linter board.