Skip to content

feat(database): implement automated database index analysis and slow query logging (#102) - #137

Open
abdulqoyumadegoke wants to merge 1 commit into
ASTROIDX556:mainfrom
abdulqoyumadegoke:feat/102-slow-query-logging-interceptor
Open

feat(database): implement automated database index analysis and slow query logging (#102)#137
abdulqoyumadegoke wants to merge 1 commit into
ASTROIDX556:mainfrom
abdulqoyumadegoke:feat/102-slow-query-logging-interceptor

Conversation

@abdulqoyumadegoke

Copy link
Copy Markdown

Closes #102

Summary of Changes

  • Slow Query Middleware & Logger: Implemented \createSlowQueryMiddleware\ in \src/database/slow-query.logger.ts\ that intercepts and times Prisma query operations against a configurable threshold (\SLOW_QUERY_THRESHOLD_MS, defaulting to 250ms).
  • Sensitive Parameter Redaction: Added \sanitizeQueryArgs\ helper to recursively sanitize sensitive parameters (passwords, tokens, secrets, private keys, hashes, credentials) in query payload logs.
  • Automated Index Analysis: Added \�nalyzeIndexSuggestions\ to inspect query filter structures and suggest composite, compound, or pagination optimizations for slow queries.
  • Config & Lifecycle Integration: Added \SLOW_QUERY_THRESHOLD_MS\ and \ENABLE_SLOW_QUERY_LOGGING\ to \databaseEnvSchema\ / \databaseConfig\ and wired the middleware in \PrismaService.
  • Unit Tests: Added comprehensive test suite in \src/database/slow-query.logger.spec.ts\ validating parameter redaction, index suggestions, threshold warnings, and error propagation.

@drips-wave

drips-wave Bot commented Aug 30, 2026

Copy link
Copy Markdown

@abdulqoyumadegoke Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@mergekeeper

mergekeeper Bot commented Aug 30, 2026

Copy link
Copy Markdown

MergeKeeper review

Scope: in scope for linked issue #102.
Verdict: clean

Implemented automated slow query logging middleware with sensitive parameter redaction and index analysis matching issue #102 requirements.

Reviewed commit: 50ecc09bdab3a01748e6d9bcba748c9b2aa92940.
CI and merge eligibility are checked separately.

@mergekeeper

mergekeeper Bot commented Aug 30, 2026

Copy link
Copy Markdown

MergeKeeper merge status

Status: blocked
PR state: open
Mergeability: conflicts / not mergeable
Checked commit: 50ecc09bdab3a01748e6d9bcba748c9b2aa92940.

Reason: One or more required CI checks failed.

Failing checks:

Next steps:

  1. Open the failing check details above and fix the reported error.
  2. Run the same checks locally where possible.
  3. Commit and push the fix.
  4. MergeKeeper will automatically re-review the updated PR.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement automated database index analysis and slow query logging interceptor

2 participants