-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Add database worker job logging #10056
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
Conversation
|
Warning Rate limit exceeded@abnegate has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 16 minutes and 38 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe changes add informational logging to database-related operations in multiple components. In the Suggested reviewers
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
Security Scan Results for PRDocker Image Scan Results
Source Code Scan Results🎉 No vulnerabilities found! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
src/Appwrite/Platform/Workers/Databases.php (2)
72-78: Review logging verbosity and sensitive data exposure.The detailed operation logging provides good observability but may be too verbose for production and exposes potentially sensitive IDs.
Consider these improvements:
- Make logging level configurable:
- Console::info("Processing database operation: \n" . \json_encode([ + if (App::getEnv('_APP_LOGGING_VERBOSE', 'false') === 'true') { + Console::info("Processing database operation: \n" . \json_encode([ 'type' => $type, 'projectId' => $project->getId(), 'databaseId' => $database->getId(), 'collectionId' => $collection->getId(), 'documentId' => $document->getId(), - ], JSON_PRETTY_PRINT)); + ], JSON_PRETTY_PRINT)); + }
- Consider structured logging:
Use the injected$logparameter for structured logging instead ofConsole::info()for better log management and filtering capabilities.
99-105: Consider consolidating redundant logging and adding timing information.The post-operation log contains identical information to the pre-operation log, which may be redundant. Consider adding execution timing or operation status.
Consider these improvements:
- Add timing and reduce redundancy:
+ $operationStart = microtime(true); // ... existing operation logic ... - Console::info("Finished processing database operation: \n" . \json_encode([ - 'type' => $type, - 'projectId' => $project->getId(), - 'databaseId' => $database->getId(), - 'collectionId' => $collection->getId(), - 'documentId' => $document->getId(), - ], JSON_PRETTY_PRINT)); + if (App::getEnv('_APP_LOGGING_VERBOSE', 'false') === 'true') { + $executionTime = microtime(true) - $operationStart; + Console::info("Completed database operation in {$executionTime}s: {$type}"); + }
- Add error context:
Consider logging operation status (success/failure) and any relevant metrics.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/Appwrite/Platform/Workers/Databases.php(4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Setup & Build Appwrite Image
- GitHub Check: Setup & Build Appwrite Image
- GitHub Check: scan
🔇 Additional comments (1)
src/Appwrite/Platform/Workers/Databases.php (1)
7-7: Import addition looks correct.The
Swoole\Timerimport is properly added to support the timer functionality used in the constructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
app/controllers/shared/api.php (1)
801-804: Consider removing unnecessary newline character in log message.The logging implementation looks good with structured JSON output containing relevant context. However, the explicit newline character in the log message might be redundant since
Console::info()likely handles line formatting automatically.Consider this refinement:
- Console::info("Triggering database event: \n" . \json_encode([ + Console::info("Triggering database event: " . \json_encode([ 'type' => $queueForDatabase->getType(), 'project' => $project->getId(), ]));
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
app/controllers/shared/api.php(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (15)
- GitHub Check: E2E Service Test (Users)
- GitHub Check: E2E Service Test (Projects)
- GitHub Check: E2E Service Test (Sites)
- GitHub Check: E2E Service Test (Databases)
- GitHub Check: E2E Service Test (Locale)
- GitHub Check: E2E Service Test (GraphQL)
- GitHub Check: E2E Service Test (FunctionsSchedule)
- GitHub Check: E2E Service Test (Console)
- GitHub Check: E2E Service Test (Account)
- GitHub Check: E2E Service Test (Avatars)
- GitHub Check: E2E Service Test (Dev Keys)
- GitHub Check: Unit Test
- GitHub Check: E2E General Test
- GitHub Check: Setup & Build Appwrite Image
- GitHub Check: scan
🔇 Additional comments (1)
app/controllers/shared/api.php (1)
25-25: LGTM: Console import added correctly.The import is necessary for the
Console::info()usage in the logging code and follows PHP import conventions.
✨ Benchmark results
⚡ Benchmark Comparison
|
What does this PR do?
(Provide a description of what this PR does and why it's needed.)
Test Plan
(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Screenshots may also be helpful.)
Related PRs and Issues
Checklist