feat(db): add structured logging for database connection pool events … - #787
Open
extolkom wants to merge 1 commit into
Open
feat(db): add structured logging for database connection pool events …#787extolkom wants to merge 1 commit into
extolkom wants to merge 1 commit into
Conversation
|
@extolkom 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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #764
Database connection pool exhaustion was previously invisible until requests
started timing out. This adds structured debug-level logging on pool acquire
and release events, plus a warn-level log when acquisition wait time exceeds
1000ms, so operators can monitor pool health proactively.
Changes
src/utils/db-pool-log.utils.tswithlogDbPoolAcquireandlogDbPoolReleasehelperssrc/utils/prisma.utils.tssrc/utils/db-pool-log.utils.test.ts(10 cases),including a boundary test at exactly 1000ms vs 1001ms
Acceptance Criteria
pool_size,idle_count,wait_time_ms,acquired_at)pool_size,idle_count,held_for_ms)Testing
pnpm test src/utils/db-pool-log.utils.test.ts— 10/10 passingpnpm check(eslint + tsc) — 0 errorsnpx prettier --check— passingorigin/main, no conflictsNotes for reviewers
Field naming follows the repo's existing
snake_caseconvention usedelsewhere in the logging utils. No new logging dependency was introduced —
this reuses the existing logger already in use in
prisma.utils.ts.