diff options
author | Robin Appelman <robin@icewind.nl> | 2023-02-09 15:44:46 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2023-02-09 17:41:43 +0100 |
commit | 08e7b20c43ec44d027a047da0acb07eea96a1bad (patch) | |
tree | 4eeed417dac2b770aa18ba80910e920e186b77ad /lib/private | |
parent | 674f4e85e1b8c8b3c24b01806350e7eced89bc4d (diff) | |
download | nextcloud-server-08e7b20c43ec44d027a047da0acb07eea96a1bad.tar.gz nextcloud-server-08e7b20c43ec44d027a047da0acb07eea96a1bad.zip |
add more performance instrumentation for app registering
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/AppFramework/Bootstrap/Coordinator.php | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/private/AppFramework/Bootstrap/Coordinator.php b/lib/private/AppFramework/Bootstrap/Coordinator.php index ff04196fef6..6f2e8b91a88 100644 --- a/lib/private/AppFramework/Bootstrap/Coordinator.php +++ b/lib/private/AppFramework/Bootstrap/Coordinator.php @@ -98,11 +98,14 @@ class Coordinator { * @param string[] $appIds */ private function registerApps(array $appIds): void { + $this->eventLogger->start('bootstrap:register_apps', ''); if ($this->registrationContext === null) { $this->registrationContext = new RegistrationContext($this->logger); } $apps = []; foreach ($appIds as $appId) { + $this->eventLogger->start("bootstrap:register_app:$appId", ''); + $this->eventLogger->start("bootstrap:register_app:$appId:autoloader", ''); /* * First, we have to enable the app's autoloader * @@ -114,6 +117,7 @@ class Coordinator { continue; } OC_App::registerAutoloading($appId, $path); + $this->eventLogger->end("bootstrap:register_app:$appId:autoloader"); /* * Next we check if there is an application class and it implements @@ -123,27 +127,33 @@ class Coordinator { $applicationClassName = $appNameSpace . '\\AppInfo\\Application'; try { if (class_exists($applicationClassName) && in_array(IBootstrap::class, class_implements($applicationClassName), true)) { + $this->eventLogger->start("bootstrap:register_app:$appId:application", ''); try { /** @var IBootstrap|App $application */ $apps[$appId] = $application = $this->serverContainer->query($applicationClassName); } catch (QueryException $e) { // Weird, but ok + $this->eventLogger->end("bootstrap:register_app:$appId"); continue; } + $this->eventLogger->end("bootstrap:register_app:$appId:application"); - $this->eventLogger->start('bootstrap:register_app_' . $appId, ''); + $this->eventLogger->start("bootstrap:register_app:$appId:register", ''); $application->register($this->registrationContext->for($appId)); - $this->eventLogger->end('bootstrap:register_app_' . $appId); + $this->eventLogger->end("bootstrap:register_app:$appId:register"); } } catch (Throwable $e) { $this->logger->emergency('Error during app service registration: ' . $e->getMessage(), [ 'exception' => $e, 'app' => $appId, ]); + $this->eventLogger->end("bootstrap:register_app:$appId"); continue; } + $this->eventLogger->end("bootstrap:register_app:$appId"); } + $this->eventLogger->start('bootstrap:register_apps:apply', ''); /** * Now that all register methods have been called, we can delegate the registrations * to the actual services @@ -153,6 +163,8 @@ class Coordinator { $this->registrationContext->delegateDashboardPanelRegistrations($this->dashboardManager); $this->registrationContext->delegateEventListenerRegistrations($this->eventDispatcher); $this->registrationContext->delegateContainerRegistrations($apps); + $this->eventLogger->end('bootstrap:register_apps:apply'); + $this->eventLogger->end('bootstrap:register_apps'); } public function getRegistrationContext(): ?RegistrationContext { |