cluster: remove shard aggregation for max_offset and under_replicated_partitions#30593
Merged
WillemKauf merged 1 commit intoMay 25, 2026
Merged
Conversation
…cated_replicas` Missed removing the `sm::shard_label` on these in 263a0e8. Aggregating these across shards doesn't reduce the number of metric series, but it does cause an oversized allocation in the `metric_aggregate_by_labels` object, since an `std::unordered_map` is used there to aggregate. Remove the shard label to prevent this oversized allocation.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes shard-level aggregation for the public kafka partition metrics max_offset and under_replicated_replicas to avoid the extra aggregation machinery (and its oversized unordered_map allocation) when aggregation does not reduce metric series cardinality for per-partition metrics.
Changes:
- Removed
.aggregate({sm::shard_label})from the publickafka:max_offsetgauge. - Removed
.aggregate({sm::shard_label})from the publickafka:under_replicated_replicasgauge.
Comment on lines
248
to
+253
| return model::offset(-1); | ||
| } | ||
| }, | ||
| sm::description( | ||
| "Latest readable offset of the partition (i.e. high watermark)"), | ||
| labels) | ||
| .aggregate({sm::shard_label}), | ||
| labels), |
Comment on lines
254
to
256
| sm::make_gauge( | ||
| "under_replicated_replicas", | ||
| [this] { |
Collaborator
Retry command for Build#84902please wait until all jobs are finished before running the slash command |
Collaborator
CI test resultstest results on build#84902
|
StephanDollberg
approved these changes
May 25, 2026
Contributor
Author
|
/backport v26.1.x |
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.
Missed removing the
sm::shard_labelon these in 263a0e8.Aggregating these across shards doesn't reduce the number of metric series, but it does cause an oversized allocation in the
metric_aggregate_by_labelsobject, since anstd::unordered_mapis used there to aggregate.Remove the shard label to prevent this oversized allocation.
Backports Required
Release Notes