Skip to content

fix(CapabilitiesManager): only log execution time if debug mode is enabled#58971

Open
szaimen wants to merge 1 commit intomasterfrom
enh/noid/slow-caps-debug-mode
Open

fix(CapabilitiesManager): only log execution time if debug mode is enabled#58971
szaimen wants to merge 1 commit intomasterfrom
enh/noid/slow-caps-debug-mode

Conversation

@szaimen
Copy link
Contributor

@szaimen szaimen commented Mar 16, 2026

  • Reason: do not spam logs with messages the admin cannot do anything about: if the system is under high load, the reporting feature leads to a lot of false-positives if the response time increases.
  • This is best reviewed like this: https://github.com/nextcloud/server/pull/58971/changes?w=1

@szaimen szaimen added this to the Nextcloud 34 milestone Mar 16, 2026
@szaimen szaimen added bug 2. developing Work in progress labels Mar 16, 2026
@szaimen szaimen force-pushed the enh/noid/slow-caps-debug-mode branch from e31f263 to 76b8024 Compare March 16, 2026 10:59
@szaimen szaimen changed the title fix(CapabilitiesManager): do not log slow capabilities if debug mode is not enabled fix(CapabilitiesManager): only check execution time if debug mode is enabled Mar 16, 2026
@szaimen szaimen force-pushed the enh/noid/slow-caps-debug-mode branch 3 times, most recently from 6755cc9 to d284eaa Compare March 16, 2026 11:24
…enabled

Signed-off-by: Simon L. <szaimen@e.mail.de>
@szaimen szaimen force-pushed the enh/noid/slow-caps-debug-mode branch from d284eaa to 89aa1ed Compare March 16, 2026 11:38
@szaimen szaimen added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Mar 16, 2026
@szaimen
Copy link
Contributor Author

szaimen commented Mar 16, 2026

/backport to stable33

@szaimen
Copy link
Contributor Author

szaimen commented Mar 16, 2026

/backport to stable32

@szaimen szaimen marked this pull request as ready for review March 16, 2026 13:50
@szaimen szaimen requested a review from a team as a code owner March 16, 2026 13:50
@szaimen szaimen requested review from ArtificialOwl, CarlSchwan, come-nc, icewind1991, miaulalala and salmart-dev and removed request for a team March 16, 2026 13:50
@szaimen szaimen changed the title fix(CapabilitiesManager): only check execution time if debug mode is enabled fix(CapabilitiesManager): only log execution time if debug mode is enabled Mar 16, 2026
@come-nc
Copy link
Contributor

come-nc commented Mar 17, 2026

The point of the log line was for users to report the bug to the application developers I believe. Is it happening a lot?

@szaimen
Copy link
Contributor Author

szaimen commented Mar 17, 2026

The point of the log line was for users to report the bug to the application developers I believe. Is it happening a lot?

Unfortunately if the system is under high load, this reporting feature leads to a lot of false-positives if the response time increases due to the high load. So I would rather only enable it in debug mode. Added the reasoning to the PR description.

Comment on lines +67 to +69
if ($debugMode) {
$timeSpent = $endTime - $startTime;
if ($timeSpent > self::ACCEPTABLE_LOADING_TIME) {
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
if ($debugMode) {
$timeSpent = $endTime - $startTime;
if ($timeSpent > self::ACCEPTABLE_LOADING_TIME) {
$timeSpent = $endTime - $startTime;
if ($debugMode && $timeSpent > self::ACCEPTABLE_LOADING_TIME) {

Copy link
Contributor

Choose a reason for hiding this comment

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

maths is cheap, makes the code more readable too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants