-
Notifications
You must be signed in to change notification settings - Fork 585
feature: expose a metric for blockbuilder owned partitions #5042
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: expose a metric for blockbuilder owned partitions #5042
Conversation
modules/blockbuilder/blockbuilder.go
Outdated
@@ -232,6 +238,10 @@ func (b *BlockBuilder) running(ctx context.Context) error { | |||
func (b *BlockBuilder) consume(ctx context.Context) (time.Duration, error) { | |||
partitions := b.getAssignedPartitions() | |||
|
|||
for _, p := range partitions { | |||
metricOwnedPartitions.WithLabelValues(strconv.Itoa(int(p))).Set(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a partition becomes un-owned, do we have a place to set this back to 0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may be wrong, but I think't we can leverage on Prometheus staleness. If the metric has not been updated in the past 5 minutes then it won't show up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. We could measure it inside b.getAssignedPartitions()
and add partition state too.
What this PR does:
It adds a new metric to track the partitions owned by a blockbuilder. This will allow us to identify problems with unassigned partitions.
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]