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

Conversation

yemkareems
Copy link
Contributor

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

  • Resolves: #

Summary

TODO

  • ...

Checklist

@yemkareems yemkareems self-assigned this Aug 31, 2024
@yemkareems yemkareems added the 3. to review Waiting for reviews label Aug 31, 2024
@susnux susnux added the bug label Aug 31, 2024
@susnux susnux added this to the Nextcloud 31 milestone Aug 31, 2024
Copy link
Contributor

@susnux susnux left a comment

Choose a reason for hiding this comment

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

As this is app code, it would be cleaner to use the public version instead of the private OC version :)

But as this is in a controller, maybe just inject the logger once in the constructor?

@@ -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 :)

@@ -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(

@@ -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(

@@ -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(

@@ -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(

@@ -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(

@yemkareems yemkareems marked this pull request as draft September 2, 2024 08:40
@susnux susnux added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2. developing Work in progress bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants