Declare and document $wgStatsdServer and $wgStatsdMetricPrefix
authorTimo Tijhof <krinklemail@gmail.com>
Fri, 26 Jun 2015 03:01:49 +0000 (04:01 +0100)
committerLegoktm <legoktm.wikipedia@gmail.com>
Thu, 2 Jul 2015 08:03:21 +0000 (08:03 +0000)
Follows-up 87dfc20.

Change-Id: Ie1b799a8f2a73b974ba8c930cfabc00e377d6eee

includes/DefaultSettings.php
includes/GlobalFunctions.php
includes/context/RequestContext.php

index 0e6ff16..69fb2e5 100644 (file)
@@ -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
index c618426..97042fd 100644 (file)
@@ -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;
index d1bc597..e676ec9 100644 (file)
@@ -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 );