MINOR: Replace Map conversions with MetricsUtils.getTags for metric tags#21948
Merged
chia7712 merged 19 commits intoapache:trunkfrom Apr 7, 2026
Merged
MINOR: Replace Map conversions with MetricsUtils.getTags for metric tags#21948chia7712 merged 19 commits intoapache:trunkfrom
chia7712 merged 19 commits intoapache:trunkfrom
Conversation
Member
|
@TaiJuWu please fix conflicts |
chia7712
reviewed
Apr 4, 2026
| private final Map<Integer, PartitionRegistration> partitionChanges = new HashMap<>(); | ||
| private final Map<Integer, Integer> partitionToUncleanLeaderElectionCount = new HashMap<>(); | ||
| private final Map<Integer, Integer> partitionToElrElectionCount = new HashMap<>(); | ||
| private final Map<Integer, Integer> partitionToUncleanLeaderElectionCount = new LinkedHashMap<>(); |
| private final Map<Integer, Integer> partitionToUncleanLeaderElectionCount = new HashMap<>(); | ||
| private final Map<Integer, Integer> partitionToElrElectionCount = new HashMap<>(); | ||
| private final Map<Integer, Integer> partitionToUncleanLeaderElectionCount = new LinkedHashMap<>(); | ||
| private final Map<Integer, Integer> partitionToElrElectionCount = new LinkedHashMap<>(); |
TaiJuWu
commented
Apr 4, 2026
| } | ||
|
|
||
| Map<String, Pattern> patternsMap = new HashMap<>(); | ||
| Map<String, Pattern> patternsMap = new LinkedHashMap<>(); |
m1a2st
approved these changes
Apr 4, 2026
cychiu8
reviewed
Apr 4, 2026
| Objects.requireNonNull(requestContext); | ||
|
|
||
| attributesMap = new HashMap<>(); | ||
| attributesMap = new LinkedHashMap<>(); |
Contributor
There was a problem hiding this comment.
when will we use new LinkedHashMap directly and when will we use MetricsUtils.getTags? do we need to align the situations?
Collaborator
Author
There was a problem hiding this comment.
There is no strict limitations we should select unless scala code. I just select minimal change during this patch.
Member
There was a problem hiding this comment.
attributesMap is not used as tags, right? If so, why do we make this change?
Collaborator
Author
There was a problem hiding this comment.
Look like I misunderstood something, will review and test this PR.
cychiu8
reviewed
Apr 4, 2026
| private final Set<TopicPartition> unrecordedPartitions; | ||
| private final FetchMetrics fetchFetchMetrics = new FetchMetrics(); | ||
| private final Map<String, FetchMetrics> perTopicFetchMetrics = new HashMap<>(); | ||
| private final Map<String, FetchMetrics> perTopicFetchMetrics = new LinkedHashMap<>(); |
cychiu8
approved these changes
Apr 4, 2026
Collaborator
Author
|
Test change by CI. |
This reverts commit 4262ed0.
chia7712
approved these changes
Apr 7, 2026
Member
|
I've updated the PR title since the original proposal was to change the parameter type from Map to LinkedHashMap. This PR doesn't fully address that scope yet. |
nileshkumar3
pushed a commit
to nileshkumar3/kafka
that referenced
this pull request
Apr 15, 2026
…ags (apache#21948) Replace HashMap with LinkedHashMap for metrics tag maps so that JMX MBean names always reflect a deterministic, insertion-order tag sequence. Also migrate Scala core module tag construction to use the existing MetricsUtils.getTags(...) helper for consistency. Reviewers: Chia-Ping Tsai <chia7712@gmail.com>, Ken Huang <s7133700@gmail.com>, Chia-Yi Chiu <cychiu8@gmail.com>
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.
Replace HashMap with LinkedHashMap for metrics tag maps so that JMX
MBean names always reflect a deterministic, insertion-order tag
sequence. Also migrate Scala core module tag construction to use the
existing MetricsUtils.getTags(...) helper for consistency.
Reviewers: Chia-Ping Tsai chia7712@gmail.com, Ken Huang
s7133700@gmail.com, Chia-Yi Chiu cychiu8@gmail.com