-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Improvement: Additional Audit Log Indexes #3194
Conversation
WalkthroughThe changes include modifications on both the backend and frontend related to audit log functionalities. A new migration script has been added to adjust indexing on the Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 ESLint
backend/src/ee/services/audit-log/audit-log-dal.tsOops! Something went wrong! :( ESLint: 8.57.1 ESLint couldn't find the plugin "@typescript-eslint/eslint-plugin". (The package "@typescript-eslint/eslint-plugin" was not found when loaded as a Node module from the directory "/backend".) It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
The plugin "@typescript-eslint/eslint-plugin" was referenced from the config file in "backend/.eslintrc.js". If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (1)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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
CodeRabbit Configuration File (
|
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)
backend/src/ee/services/audit-log/audit-log-dal.ts (1)
115-116
: Reduced query timeout aligns with server limitsGood adjustment to the timeout value. Reducing from 120 seconds to 29.5 seconds aligns with the server timeout while preventing long-running queries from consuming excessive resources.
Small typo in the comment: "les" should be "less".
- // we time out long-running queries to prevent DB resource issues (a little les than 30 seconds [server timeout]) + // we time out long-running queries to prevent DB resource issues (a little less than 30 seconds [server timeout])
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
backend/src/db/migrations/20250306134330_additional-audit-log-indexes.ts
(1 hunks)backend/src/ee/services/audit-log/audit-log-dal.ts
(2 hunks)frontend/src/pages/organization/AuditLogsPage/components/LogsTable.tsx
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Check TS and Lint
- GitHub Check: Check Frontend Type and Lint check
- GitHub Check: Run integration test
🔇 Additional comments (4)
frontend/src/pages/organization/AuditLogsPage/components/LogsTable.tsx (1)
109-109
: Improved button loading state handlingGood enhancement to the loading state logic. The button now correctly shows the loading indicator both when fetching the next page of logs and during the initial pending state, which provides better visual feedback to users.
backend/src/ee/services/audit-log/audit-log-dal.ts (1)
94-94
: Optimization of secretPath filteringGood change to the query condition. Using the
->>
operator for direct value extraction is more efficient than the previous@>
withjsonb_build_object
approach, especially when paired with the new index created in the migration.backend/src/db/migrations/20250306134330_additional-audit-log-indexes.ts (2)
5-19
: Well-designed migration for audit log optimizationThe migration effectively adds targeted indexes to improve audit log query performance. The approach of checking for column existence before creating indexes is robust and prevents errors during migration execution.
The composite index on
projectId
,secretPath
(extracted fromeventMetadata
), andcreatedAt DESC
is particularly valuable as it directly supports the query pattern modified in the audit-log-dal.ts file.
21-34
: Proper rollback implementationWell-implemented rollback function that properly removes all indexes created in the up migration. The checks for column existence ensure the migration will work correctly even if the schema changes in the future.
Please coordinate with @maidul98 on merging and deployment of this. |
Description 📣
This PR adds additional index to the audit logs table and decreases the timeout on the audit log query to match the server timeout duration.
Type ✨
Tests 🛠️
# Here's some code block to paste some code snippets
Summary by CodeRabbit