From: Timo Tijhof Date: Fri, 26 Jun 2015 03:01:49 +0000 (+0100) Subject: Declare and document $wgStatsdServer and $wgStatsdMetricPrefix X-Git-Tag: 1.31.0-rc.0~10900^2 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=4ef96ff1f29a3a3c806cb5cd69663d1d932dc3c7;p=lhc%2Fweb%2Fwiklou.git Declare and document $wgStatsdServer and $wgStatsdMetricPrefix Follows-up 87dfc20. Change-Id: Ie1b799a8f2a73b974ba8c930cfabc00e377d6eee --- diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 0e6ff165cc..69fb2e56db 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -5692,6 +5692,29 @@ $wgAggregateStatsID = false; */ $wgStatsFormatString = "stats/%s - %s 1 1 1 1 %s\n"; +/** + * Destination of statsd metrics. + * + * A host or host:port of a statsd server. Port defaults to 8125. + * + * If not set, statsd metrics will not be collected. + * + * @see wfLogProfilingData + * @since 1.25 + */ +$wgStatsdServer = false; + +/** + * Prefix for metric names sent to wgStatsdServer. + * + * Defaults to "MediaWiki". + * + * @see RequestContext::getStats + * @see BufferingStatsdDataFactory + * @since 1.25 + */ +$wgStatsdMetricPrefix = false; + /** * InfoAction retrieves a list of transclusion links (both to and from). * This number puts a limit on that query in the case of highly transcluded diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index c6184261e7..97042fd1f0 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1248,7 +1248,7 @@ function wfLogProfilingData() { $profiler->logData(); $config = $context->getConfig(); - if ( $config->has( 'StatsdServer' ) ) { + if ( $config->get( 'StatsdServer' ) ) { $statsdServer = explode( ':', $config->get( 'StatsdServer' ) ); $statsdHost = $statsdServer[0]; $statsdPort = isset( $statsdServer[1] ) ? $statsdServer[1] : 8125; diff --git a/includes/context/RequestContext.php b/includes/context/RequestContext.php index d1bc597087..e676ec96fb 100644 --- a/includes/context/RequestContext.php +++ b/includes/context/RequestContext.php @@ -131,7 +131,7 @@ class RequestContext implements IContextSource { public function getStats() { if ( $this->stats === null ) { $config = $this->getConfig(); - $prefix = $config->has( 'StatsdMetricPrefix' ) + $prefix = $config->get( 'StatsdMetricPrefix' ) ? rtrim( $config->get( 'StatsdMetricPrefix' ), '.' ) : 'MediaWiki'; $this->stats = new BufferingStatsdDataFactory( $prefix );