* @file
* @ingroup Profiler
*/
+use MediaWiki\MediaWikiServices;
/**
* ProfilerOutput class that flushes profiling data to the profiling
* @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 );