Skip to content

feature: expose a metric for blockbuilder owned partitions#5042

Merged
javiermolinar merged 6 commits intografana:mainfrom
javiermolinar:tempo-measure-owned-partitions
May 26, 2025
Merged

feature: expose a metric for blockbuilder owned partitions#5042
javiermolinar merged 6 commits intografana:mainfrom
javiermolinar:tempo-measure-owned-partitions

Conversation

@javiermolinar
Copy link
Copy Markdown
Contributor

@javiermolinar javiermolinar commented Apr 23, 2025

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

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

Comment thread modules/blockbuilder/blockbuilder.go Outdated
partitions := b.getAssignedPartitions()

for _, p := range partitions {
metricOwnedPartitions.WithLabelValues(strconv.Itoa(int(p))).Set(1)
Copy link
Copy Markdown
Contributor

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?

Copy link
Copy Markdown
Contributor Author

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

Copy link
Copy Markdown
Contributor

@mapno mapno left a 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.

Comment thread modules/blockbuilder/blockbuilder.go Outdated
@javiermolinar javiermolinar merged commit a3a2b8e into grafana:main May 26, 2025
19 checks passed
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.

3 participants