Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: logging done at the beginning and end of getUsersDetails, getUserData and fillStorageInfo #47660

Draft
wants to merge 2 commits into
base: stable28
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions apps/provisioning_api/lib/Controller/AUserData.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@ public function __construct(string $appName,
* @throws OCSNotFoundException
*/
protected function getUserData(string $userId, bool $includeScopes = false): ?array {
\OC::$server->get(\Psr\Log\LoggerInterface::class)->error(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
\OC::$server->get(\Psr\Log\LoggerInterface::class)->error(
\OCP\Server::get(\Psr\Log\LoggerInterface::class)->error(

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @susnux, This is a draft pr to help us understand why the user list is slow. Hence not merging the same

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem, it just was set to ´3 to review` so I gave it a quick look :)

'Start of getUserData for {user}',
[
'user' => $userId,
'ticket' => '66440',
]
);
$currentLoggedInUser = $this->userSession->getUser();
assert($currentLoggedInUser !== null, 'No user logged in');

Expand Down Expand Up @@ -222,6 +229,13 @@ protected function getUserData(string $userId, bool $includeScopes = false): ?ar
'setDisplayName' => $backend instanceof ISetDisplayNameBackend || $backend->implementsActions(Backend::SET_DISPLAYNAME),
'setPassword' => $backend instanceof ISetPasswordBackend || $backend->implementsActions(Backend::SET_PASSWORD),
];
\OC::$server->get(\Psr\Log\LoggerInterface::class)->error(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
\OC::$server->get(\Psr\Log\LoggerInterface::class)->error(
\OCP\Server::get(\Psr\Log\LoggerInterface::class)->error(

'End of getUserData for {user}',
[
'user' => $userId,
'ticket' => '66440',
]
);

return $data;
}
Expand Down Expand Up @@ -256,6 +270,14 @@ protected function getUserSubAdminGroupsData(string $userId): array {
* @throws OCSException
*/
protected function fillStorageInfo(string $userId): array {
\OC::$server->get(\Psr\Log\LoggerInterface::class)->error(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
\OC::$server->get(\Psr\Log\LoggerInterface::class)->error(
\OCP\Server::get(\Psr\Log\LoggerInterface::class)->error(

'Start of fillStorageInfo for {user}',
[
'user' => $userId,
'ticket' => '66440',
]
);

try {
\OC_Util::tearDownFS();
\OC_Util::setupFS($userId);
Expand Down Expand Up @@ -294,6 +316,14 @@ protected function fillStorageInfo(string $userId): array {
\OC_Util::tearDownFS();
return [];
}
\OC::$server->get(\Psr\Log\LoggerInterface::class)->error(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
\OC::$server->get(\Psr\Log\LoggerInterface::class)->error(
\OCP\Server::get(\Psr\Log\LoggerInterface::class)->error(

'End of fillStorageInfo for {user}',
[
'user' => $userId,
'ticket' => '66440',
]
);

return $data;
}
}
14 changes: 14 additions & 0 deletions apps/provisioning_api/lib/Controller/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,13 @@ public function getUsersDetails(string $search = '', int $limit = null, int $off
$usersDetails = [];
foreach ($users as $userId) {
$userId = (string) $userId;
\OC::$server->get(\Psr\Log\LoggerInterface::class)->error(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
\OC::$server->get(\Psr\Log\LoggerInterface::class)->error(
\OCP\Server::get(\Psr\Log\LoggerInterface::class)->error(

'Start of getUsersDetails for {user}',
[
'user' => $userId,
'ticket' => '66440',
]
);
try {
$userData = $this->getUserData($userId);
} catch (OCSNotFoundException $e) {
Expand All @@ -231,6 +238,13 @@ public function getUsersDetails(string $search = '', int $limit = null, int $off
// only showing its id
$usersDetails[$userId] = ['id' => $userId];
}
\OC::$server->get(\Psr\Log\LoggerInterface::class)->error(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
\OC::$server->get(\Psr\Log\LoggerInterface::class)->error(
\OCP\Server::get(\Psr\Log\LoggerInterface::class)->error(

'End of getUsersDetails for {user}',
[
'user' => $userId,
'ticket' => '66440',
]
);
}

return new DataResponse([
Expand Down
Loading