Page MenuHomePhabricator

Update logging in ConfirmEdit
Open, Needs TriagePublic

Description

Logins, signup etc use new logging stuff

			LoggerFactory::getInstance( 'authevents' )->info( 'Captcha submitted on account creation', [
				'event' => 'captcha.submit',
				'eventType' => 'accountcreation',
				'successful' => $success,
			] );

Edits uses

	function log( $message ) {
		wfDebugLog( 'captcha', 'ConfirmEdit: ' . $message . '; ' .  $this->trigger );
	}

and

	protected function passCaptcha( $index, $word ) {
		// Don't check the same CAPTCHA twice in one session,
		// if the CAPTCHA was already checked - Bug T94276
		if ( isset( $this->captchaSolved ) ) {
			return $this->captchaSolved;
		}

		$info = $this->retrieveCaptcha( $index );
		if ( $info ) {
			if ( $this->keyMatch( $word, $info ) ) {
				$this->log( "passed" );
				$this->clearCaptcha( $index );
				$this->captchaSolved = true;
				return true;
			} else {
				$this->clearCaptcha( $index );
				$this->log( "bad form input" );
				$this->captchaSolved = false;
				return false;
			}
		} else {
			$this->log( "new captcha session" );
			return false;
		}
	}

From mediawiki-core on IRC

[21:14:18] <tgr> it'd be cool to evolve that one-off thing into some generic method of pinging statsd in a log event
[21:15:08] <tgr> just add 'metrics' => ['captcha.edit.display'] or something and then have something process that and ping statsd
[21:15:18] <tgr> does not seem terribly hard to do
[21:16:00] <tgr> write a monolog statsd handler in core, add it to all channels

Event Timeline

The one-off thing is AuthManagerStatsdHandler which converts events of the authevents channel intro metrics keys and pings statsd with them. (IMO it's a nice arrangement - small wikis can just look them up in the logfiles, we store them in Logstash so we can look up wiki/IP/etc if needed, and we get dashboards more or less for free.)

Seems VE captcha logs (and hence, stats) may also be different... See also https://edit-analysis.wmflabs.org/compare/ and T136859

Reedy added a parent task: Restricted Task.Feb 17 2017, 12:39 PM