Skip to content

Feature/ccm 16073 rate limit it fix#166

Merged
mjewildnhs merged 11 commits intofeature/CCM-16073-rate-limitfrom
feature/CCM-16073-rate-limit-it-fix
Apr 29, 2026
Merged

Feature/ccm 16073 rate limit it fix#166
mjewildnhs merged 11 commits intofeature/CCM-16073-rate-limitfrom
feature/CCM-16073-rate-limit-it-fix

Conversation

@mjewildnhs
Copy link
Copy Markdown
Contributor

Description

Context

Type of changes

  • Refactoring (non-breaking change)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would change existing functionality)
  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I am familiar with the contributing guidelines
  • I have followed the code style of the project
  • I have added tests to cover my changes
  • I have updated the documentation accordingly
  • This PR is a result of pair or mob programming

Sensitive Information Declaration

To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including PII (Personal Identifiable Information) / PID (Personal Identifiable Data) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter.

  • I confirm that neither PII/PID nor sensitive data are included in this PR and the codebase changes.

@mjewildnhs mjewildnhs changed the base branch from main to feature/CCM-16073-rate-limit April 28, 2026 13:00
Additional handler logging and observability

Fix retry time for partial batch rate limiting

Add follow option to debug test script

Add since var to int debug script

Fix issue when half open and all probes fail

High resolution storage metrics
@mjewildnhs mjewildnhs force-pushed the feature/CCM-16073-rate-limit-it-fix branch from 9c573aa to 34af71e Compare April 28, 2026 13:48
@mjewildnhs mjewildnhs force-pushed the feature/CCM-16073-rate-limit-it-fix branch from e641be8 to bbfc5d7 Compare April 28, 2026 16:24
@mjewildnhs mjewildnhs marked this pull request as ready for review April 29, 2026 09:10
@mjewildnhs mjewildnhs requested a review from a team as a code owner April 29, 2026 09:10
Comment on lines +49 to +56
if isOpen then
if not cbEnabled then
effectiveRate = targetRateLimit
elseif isOpen then
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we can incorporate cbEnabled more nicely than this... We should only have to:

  • bring up new circuit state as closed (and not recovering)
  • disable the circuit open/close mechanisms

That should be enough.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

CB/RL design docs have been updated, so this is not needed any more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've incorporated the changes.
With 2 additional fixes for fresh state no is_open in Redis yet:

  1. (lines 95-97): When the circuit is open on a fresh endpoint, bucketTokens is zeroed and bucketRefilledAt is set to now, producing 0 generated tokens. Without seeding 1 probe token, nothing is ever processed, record-result never runs, is_open is never written, and the endpoint is permanently blocked.

  2. bucketRefilledAt independent check: needInit is derived from is_open existence, but admit.lua never writes is_open — only record-result.lua does. With CB disabled, needInit stays true across calls, resetting bucketRefilledAt = now every time and producing 0 tokens indefinitely. The fix checks bucket_refilled_at's own raw value so it reads back what admit wrote on the previous call.

Comment thread lambdas/https-client-lambda/src/services/admit.lua Outdated
Comment thread lambdas/https-client-lambda/src/services/admit.lua Outdated
Comment thread lambdas/https-client-lambda/src/services/admit.lua Outdated
-- LOAD STATE
--------------------------------------------------------------------------------

local cbEnabled = probeRateLimit > 0
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Isn't this a separate, per-target config param which should be passed into the script?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Probe rate is a global env var currently

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No, I mean cbEnabled. Isn't this a per-target config which is passed in?

Comment thread lambdas/https-client-lambda/src/services/admit.lua Outdated
Comment thread lambdas/https-client-lambda/src/services/admit.lua Outdated
@mjewildnhs mjewildnhs merged commit 79ac0ae into feature/CCM-16073-rate-limit Apr 29, 2026
25 checks passed
@mjewildnhs mjewildnhs deleted the feature/CCM-16073-rate-limit-it-fix branch April 29, 2026 14:21
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.

2 participants