feat: add outcome logging for tenant pools#1018
Conversation
There was a problem hiding this comment.
Pull request overview
Adds tenant-level outcome logging for tenant pool cache lookups (hit/miss/stale) as an alternative to high-cardinality tenant metrics, with configurable sampling via environment variables.
Changes:
- Introduces sampled logging for tenant pool cache lookups in
PoolManager.getPool(). - Adds two new config knobs to control hit/miss log sampling rates and clamps env values to
[0, 1]. - Adds Jest and Vitest coverage to validate logging behavior and sample-rate parsing.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/internal/database/pool.ts | Logs tenant pool cache lookup outcomes with sampling controls. |
| src/config.ts | Adds config fields + env parsing helper for log sample rates. |
| src/test/pool-cache.test.ts | Adds Jest tests covering lookup logging and sampling enable/disable behavior. |
| src/config.test.ts | Adds Vitest tests ensuring env sample-rate parsing/clamping behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d70c1c3 to
360cf74
Compare
Coverage Report for CI Build 24402681358Coverage increased (+0.06%) to 82.476%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
2848914 to
7bf7961
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
7bf7961 to
29569f2
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
What kind of change does this PR introduce?
feat
What is the current behavior?
Tenant pool cache hit ratio is an aggregate metric. We can't see tenant distribution.
What is the new behavior?
Adding tenant for metric isn't feasible due to high cardinality so we log its outcome.
Additional context
There are two knobs for hits & misses to adjust sampling ratio. Ideally, we can do no sampling for miss since rare but sample hits. By default, they start with full sampling (no logs).
Pool cache tests are moved to vitest.