Skip to content

feat: add outcome logging for tenant pools#1018

Merged
fenos merged 1 commit intomasterfrom
ferhat/tenant-pool-logging
Apr 14, 2026
Merged

feat: add outcome logging for tenant pools#1018
fenos merged 1 commit intomasterfrom
ferhat/tenant-pool-logging

Conversation

@ferhatelmas
Copy link
Copy Markdown
Member

@ferhatelmas ferhatelmas commented Apr 14, 2026

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.

@ferhatelmas ferhatelmas requested a review from a team as a code owner April 14, 2026 11:40
Copilot AI review requested due to automatic review settings April 14, 2026 11:40
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/config.ts
@ferhatelmas ferhatelmas force-pushed the ferhat/tenant-pool-logging branch from d70c1c3 to 360cf74 Compare April 14, 2026 11:46
@coveralls
Copy link
Copy Markdown

coveralls commented Apr 14, 2026

Coverage Report for CI Build 24402681358

Coverage increased (+0.06%) to 82.476%

Details

  • Coverage increased (+0.06%) from the base build.
  • Patch coverage: 1 uncovered change across 1 file (45 of 46 lines covered, 97.83%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
src/internal/database/pool.ts 27 26 96.3%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 33945
Covered Lines: 30460
Line Coverage: 89.73%
Relevant Branches: 7443
Covered Branches: 3675
Branch Coverage: 49.38%
Branches in Coverage %: Yes
Coverage Strength: 347.57 hits per line

💛 - Coveralls

@ferhatelmas ferhatelmas force-pushed the ferhat/tenant-pool-logging branch 2 times, most recently from 2848914 to 7bf7961 Compare April 14, 2026 13:03
@ferhatelmas ferhatelmas requested a review from Copilot April 14, 2026 13:04
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@fenos fenos merged commit c863126 into master Apr 14, 2026
12 of 13 checks passed
@fenos fenos deleted the ferhat/tenant-pool-logging branch April 14, 2026 14:08
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.

4 participants