Skip to content

Surface queue rate limited state in TaskQueueStats#10944

Draft
rkannan82 wants to merge 4 commits into
temporalio:mainfrom
rkannan82:kannan/wci-rate-limit-stats
Draft

Surface queue rate limited state in TaskQueueStats#10944
rkannan82 wants to merge 4 commits into
temporalio:mainfrom
rkannan82:kannan/wci-rate-limit-stats

Conversation

@rkannan82

@rkannan82 rkannan82 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What

Populates the new rate_limiting_active field in TaskQueueStats so auto-scaling systems can detect when backlog growth is caused by rate limiting rather than insufficient worker capacity.

Why

When a task queue has a whole-queue rate limit configured, WorkerControllerInterface (WCI) PullStats path sees backlog and scales up workers. More workers don't help — they poll but can't receive tasks faster than the rate limit. This field lets WCI suppress scaling in that case.

How did you test it?

  • Unit tests for IsWholeQueueRateLimitingActive — verifies whole-queue rate limit is detected, per-key-only is not

🤖 Generated with Claude Code

rkannan82 and others added 3 commits July 6, 2026 15:52
Per-fairness-key rate limiting should not suppress WCI scaling because
other keys may still need workers. Only whole-queue rate limits indicate
that adding more workers genuinely cannot help.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add SyncMatchOutcomeFairnessKeyRateLimited to hook enum instead of
  collapsing per-key rate limiting into NotMatched. Let hooks decide
  how to handle each outcome.
- Rename syncMatchPerKeyRateLimited to syncMatchFairnessKeyRateLimited.
- Use switch in MatchTaskImmediately so new enum values are handled
  explicitly.
- Replace wholeQueueLimited bool return from findMatch with a
  rateLimitKind enum for a clearer API.
- Remove hook-consumer-specific references from comments.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add IsWholeQueueRateLimitingActive() to rateLimitManager and populate
RateLimitingActive on stats entries in GetStatsByPriority(). MergeStats
ORs the boolean across partitions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@rkannan82 rkannan82 changed the title Surface whole-queue rate limiting state in TaskQueueStats Surface queue rate limited state in TaskQueueStats Jul 7, 2026
@rkannan82 rkannan82 force-pushed the kannan/wci-rate-limit-stats branch from 39ad6e8 to 3d53eb1 Compare July 7, 2026 05:18
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.

1 participant