diff options
author | Joas Schilling <coding@schilljs.com> | 2020-09-23 13:14:01 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-09-23 13:14:01 +0300 |
commit | 74f4dbe9de9dd720c3392c4e5d49cc63a6f6e1d1 (patch) | |
tree | be7be5901b920a9d3f7d0786c572e04e9ddb1d9d /lib | |
parent | 7d0602792280f88af6867db0131d1bf8984b2c2c (diff) |
Log an error if a dashboard widget loads longer than 1 second
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Dashboard/Manager.php | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/private/Dashboard/Manager.php b/lib/private/Dashboard/Manager.php index bc57326dff0..94b80a3b4a4 100644 --- a/lib/private/Dashboard/Manager.php +++ b/lib/private/Dashboard/Manager.php @@ -95,7 +95,16 @@ class Manager implements IManager { } try { + $startTime = microtime(true); $widget->load(); + $endTime = microtime(true); + $duration = $endTime - $startTime; + if ($duration > 1) { + \OC::$server->getLogger()->error('Dashboard widget {widget} took {duration} seconds to load.', [ + 'widget' => $widget->getId(), + 'duration' => round($duration, 2), + ]); + } } catch (Throwable $e) { \OC::$server->getLogger()->logException($e, [ 'message' => 'Error during dashboard widget loading: ' . $e->getMessage(), |