Log an error if a dashboard widget loads longer than 1 second
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
7d06027922
commit
74f4dbe9de
|
@ -95,7 +95,16 @@ class Manager implements IManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
$startTime = microtime(true);
|
||||||
$widget->load();
|
$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) {
|
} catch (Throwable $e) {
|
||||||
\OC::$server->getLogger()->logException($e, [
|
\OC::$server->getLogger()->logException($e, [
|
||||||
'message' => 'Error during dashboard widget loading: ' . $e->getMessage(),
|
'message' => 'Error during dashboard widget loading: ' . $e->getMessage(),
|
||||||
|
|
Loading…
Reference in New Issue