Merge "Change Title::getPreviousRevisionID (and next) to ignore PRIMARY"
[lhc/web/wiklou.git] / includes / profiler / output / ProfilerOutputStats.php
index a635793..bb86551 100644 (file)
@@ -21,6 +21,7 @@
  * @file
  * @ingroup Profiler
  */
+use MediaWiki\MediaWikiServices;
 
 /**
  * ProfilerOutput class that flushes profiling data to the profiling
@@ -37,14 +38,11 @@ class ProfilerOutputStats extends ProfilerOutput {
         * @param array $stats
         */
        public function log( array $stats ) {
-               $contextStats = $this->collector->getContext()->getStats();
+               $prefix = isset( $this->params['prefix'] ) ? $this->params['prefix'] : '';
+               $contextStats = MediaWikiServices::getInstance()->getStatsdDataFactory();
 
                foreach ( $stats as $stat ) {
-                       // Sanitize the key
-                       $key = str_replace( '::', '.', $stat['name'] );
-                       $key = preg_replace( '/[^a-z.]+/i', '_', $key );
-                       $key = trim( $key, '_.' );
-                       $key = str_replace( array( '._', '_.' ), '.', $key );
+                       $key = "{$prefix}.{$stat['name']}";
 
                        // Convert fractional seconds to whole milliseconds
                        $cpu = round( $stat['cpu'] * 1000 );