Skip to content

Fix task slots used metric#1391

Open
Sushisource wants to merge 3 commits into
mainfrom
sj/fix-task-slots-used-metric
Open

Fix task slots used metric#1391
Sushisource wants to merge 3 commits into
mainfrom
sj/fix-task-slots-used-metric

Conversation

@Sushisource

@Sushisource Sushisource commented Jul 9, 2026

Copy link
Copy Markdown
Member

What was changed

Fixed worker task slot metric accounting when releasing a permit. The drop-time adjustment is now applied only to worker_task_slots_available, rather than also incrementing worker_task_slots_used.

Added an integration test covering an idle autoscaling activity worker with reserved polling slots.

Why?

Released permits were already removed from the extant permit count, but the metric update added one back to both available and used slots. This could leave worker_task_slots_used at 1 after all activity work completed, until another reservation updated the gauge.

The available-slot adjustment is still necessary because the underlying RAII permit remains alive during its drop callback; it does not apply to used-slot accounting.

Checklist

  1. Closes [Bug] temporal_worker_task_slots_used (sum across worker types) never reaches 0 during inter-activity gaps sdk-python#1489

  2. How was this tested:

  1. Any docs updates needed?

@Sushisource Sushisource requested a review from a team as a code owner July 9, 2026 21:31
@Sushisource Sushisource changed the title Sj/fix task slots used metric Fix task slots used metric Jul 9, 2026
@Sushisource Sushisource force-pushed the sj/fix-task-slots-used-metric branch from 7c5a4ab to e76472d Compare July 9, 2026 23:05
Comment thread crates/sdk-core/tests/integ_tests/metrics_tests.rs Outdated
@Sushisource Sushisource force-pushed the sj/fix-task-slots-used-metric branch from e76472d to 3c605ee Compare July 10, 2026 15:33
@Sushisource Sushisource enabled auto-merge (squash) July 10, 2026 15:33
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.

[Bug] temporal_worker_task_slots_used (sum across worker types) never reaches 0 during inter-activity gaps

2 participants