diff options
author | diosmosis <diosmosis@users.noreply.github.com> | 2018-08-01 00:48:07 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-01 00:48:07 +0300 |
commit | 6cb6548c19a93b3c9c173d6bb9c1a9f68835f252 (patch) | |
tree | ba39c77ddd6cd53f19cfd26e8fa5e8605f391b3d /plugins/Monolog | |
parent | 8210ff8e201f9635dbdc2e9bde63c11f169fbd83 (diff) |
Add some simple profiling output to core:archive command (#13215)
* Initial code to gather performance measurements across processes.
* Get proof of concept to work.
* couple tweaks
* Modified to use a custom log file instead of option table.
* add peak memory value
Diffstat (limited to 'plugins/Monolog')
-rw-r--r-- | plugins/Monolog/config/config.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/plugins/Monolog/config/config.php b/plugins/Monolog/config/config.php index 95463b91de..04cd1dc21c 100644 --- a/plugins/Monolog/config/config.php +++ b/plugins/Monolog/config/config.php @@ -3,6 +3,7 @@ use Interop\Container\ContainerInterface; use Monolog\Logger; use Piwik\Log; +use Piwik\Plugins\Monolog\Handler\FileHandler; return array( @@ -105,4 +106,17 @@ return array( return '%level% %tag%[%datetime%] %message%'; }), + 'archiving.performance.handlers' => function (ContainerInterface $c) { + $logFile = trim($c->get('ini.Debug.archive_profiling_log')); + if (empty($logFile)) { + return [new \Monolog\Handler\NullHandler()]; + } + + $fileHandler = new FileHandler($logFile, \Psr\Log\LogLevel::INFO); + $fileHandler->setFormatter($c->get('log.lineMessageFormatter.file')); + return [$fileHandler]; + }, + + 'archiving.performance.logger' => DI\object(Logger::class) + ->constructor('matomo.archiving.performance', DI\get('archiving.performance.handlers'), DI\get('log.processors')), ); |