chore(shard-manager): Emit metrics on total number of executors#7636
Merged
gazi-yestemirova merged 2 commits intocadence-workflow:masterfrom Jan 23, 2026
Merged
Conversation
Signed-off-by: Gaziza Yestemirova <gaziza@uber.com>
arzonus
reviewed
Jan 23, 2026
| } | ||
|
|
||
| p.emitActiveShardMetric(namespaceState.ShardAssignments, metricsLoopScope) | ||
| p.emitExecutorMetric(namespaceState, len(staleExecutors), metricsLoopScope) |
Contributor
There was a problem hiding this comment.
In case of failures of AssignShards the metric will not be emitted. I think we can emit this metric right before a call of AssignShards
Contributor
Author
There was a problem hiding this comment.
So, I wanted to emit the "committed" state of the executors after the transaction, because it will be retried, so we avoid potentially emitting inconsistent data.
But I think emitting "observed" state is also reasonable. Let me update it.
Contributor
There was a problem hiding this comment.
nit: Perhaps, we also should add it for the shadow namespaces, don't we?
Contributor
Author
There was a problem hiding this comment.
yes, we do, we emit the metric before exiting for shadow executors
Contributor
Author
Signed-off-by: Gaziza Yestemirova <gaziza@uber.com>
474d530
into
cadence-workflow:master
42 of 43 checks passed
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 changed?
This PR adds shard_distributor_total_executors gauge metric to track the number of executors registered with the shard distributor.
The metric is emitted during each rebalance loop, with executor statuses (e.g., ExecutorStatusACTIVE, ExecutorStatusDRAINING, ExecutorStatusDRAINED.
And it is tagged with namespace and namespace_type for per-namespace monitoring.
Why?
Overall to monitor the health of the shard distributor cluster - know how many executors are actively participating in shard distribution.
To detect executor churn or scaling events
Alert when executor count falls below expected thresholds, which could indicate deployment issues or infrastructure problems.
How did you test it?
Verified metric is emitted in local and dev environments with correct executor counts.
Potential risks
N/A
Release notes
Documentation Changes