[CELEBORN-2387] Add ReserveSlotsFailCount worker metric#3765
Open
shellfish007 wants to merge 2 commits into
Open
[CELEBORN-2387] Add ReserveSlotsFailCount worker metric#3765shellfish007 wants to merge 2 commits into
shellfish007 wants to merge 2 commits into
Conversation
handleReserveSlots already replies with distinct non-success status codes (WORKER_SHUTDOWN, NO_AVAILABLE_WORKING_DIR, RESERVE_SLOTS_FAILED for primary/replica), but none of these paths incremented a counter. Slot reservation was the only major worker operation without a *FailCount metric (push, replicate, fetch, commit, register all have one), so failed reservations were invisible to dashboards and only visible via logs. Add WorkerSource.RESERVE_SLOTS_FAIL_COUNT and increment it on every non-success reply path in Controller.handleReserveSlots, following the existing *FailCount convention.
There was a problem hiding this comment.
Pull request overview
This pull request adds a new worker-side metric counter to make slot reservation failures visible in metrics/dashboards by incrementing a ReserveSlotsFailCount counter on non-success reply paths in Controller.handleReserveSlots.
Changes:
- Register a new worker metric counter
ReserveSlotsFailCountinWorkerSource. - Increment
ReserveSlotsFailCounton each non-success response path inController.handleReserveSlots.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| worker/src/main/scala/org/apache/celeborn/service/deploy/worker/WorkerSource.scala | Declares and registers the new ReserveSlotsFailCount counter. |
| worker/src/main/scala/org/apache/celeborn/service/deploy/worker/Controller.scala | Increments ReserveSlotsFailCount before returning non-success ReserveSlotsResponse results. |
Comments suppressed due to low confidence (1)
worker/src/main/scala/org/apache/celeborn/service/deploy/worker/Controller.scala:248
RESERVE_SLOTS_FAIL_COUNTis incremented afterdestroyWriters(...). If cleanup throws, the metric won't be recorded and the RPC reply may never be sent. Increment the fail counter before cleanup so reservation failures are still counted even when cleanup fails.
destroyWriters(primaryLocs, shuffleKey)
destroyWriters(replicaLocs, shuffleKey)
workerSource.incCounter(WorkerSource.RESERVE_SLOTS_FAIL_COUNT)
context.reply(ReserveSlotsResponse(StatusCode.RESERVE_SLOTS_FAILED, msg))
return
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
221
to
225
| logWarning(s"[handleReserveSlots] $msg, will destroy writers.") | ||
| destroyWriters(primaryLocs, shuffleKey) | ||
| workerSource.incCounter(WorkerSource.RESERVE_SLOTS_FAIL_COUNT) | ||
| context.reply(ReserveSlotsResponse(StatusCode.RESERVE_SLOTS_FAILED, msg)) | ||
| return |
Ensures the failure is counted even if destroyWriters throws, per review feedback.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Adds a new worker metric,
ReserveSlotsFailCount, and increments it on every non-success path ofController.handleReserveSlots.Why are the changes needed?
handleReserveSlotsalready replies with distinct non-success status codes:WORKER_SHUTDOWN— worker is shutting downNO_AVAILABLE_WORKING_DIR— no healthy local dirs and no remote storageRESERVE_SLOTS_FAILED— not all primary partitions could be satisfiedRESERVE_SLOTS_FAILED— not all replica partitions could be satisfied...but none of these paths incremented a counter. Slot reservation was the only major worker operation without a
*FailCountmetric (push, replicate, fetch, commit, register all have one), so failed reservations were invisible to metrics/dashboards and only visible via logs.WorkerSource.scaladeclaresRESERVE_SLOTS_FAIL_COUNT = "ReserveSlotsFailCount"and registers it withaddCounter(...), alongsideSlotsAllocated.Controller.scalacallsworkerSource.incCounter(WorkerSource.RESERVE_SLOTS_FAIL_COUNT)before each of the four non-successcontext.reply(...)sites inhandleReserveSlots.One fail counter per failed reservation regardless of cause, matching the existing
*FailCountconvention (e.g.CommitFilesFailCount,RegisterWithMasterFailCount). This gives a single "reserve slots did not succeed" rate; the specific cause remains distinguishable via the status code in logs.Does this PR introduce any user-facing change?
Yes — adds a new worker metric
ReserveSlotsFailCount. No config or API changes.How was this patch tested?
Follows the established counter pattern exactly (constant +
addCounterregistration +incCounterat the failure path), with no new imports or signatures.