fix(storage:metrics): eagerly initialize meters with only topicType tag#493
Merged
juha-aiven merged 1 commit intomainfrom Jan 22, 2026
Merged
fix(storage:metrics): eagerly initialize meters with only topicType tag#493juha-aiven merged 1 commit intomainfrom
juha-aiven merged 1 commit intomainfrom
Conversation
Restores the eager initialization logic for global metrics that was accidentally removed in aa045fb. Meters with only the topicType tag (e.g., diskless bytesIn/bytesOut) are broker-level metrics that should be registered immediately on construction, ensuring they are visible in monitoring systems from broker startup. Adds tests to prevent future regressions by verifying metrics are registered in the Yammer registry immediately after construction.
eb8f0f4 to
399bb62
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a regression where broker-level metrics with only the topicType tag were not being eagerly initialized, making them invisible in monitoring systems until traffic occurred. The fix centralizes the eager initialization logic in the MeterWrapper constructor to handle both tag-less metrics and metrics with only the topicType tag.
Changes:
- Updated
MeterWrapperconstructor to eagerly initialize meters with onlytopicTypetag in addition to tag-less meters - Removed redundant explicit
meter()calls inBrokerTopicMetricsconstructor since eager initialization now happens automatically - Added comprehensive tests to verify eager initialization and prevent future regressions
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| storage/src/main/java/org/apache/kafka/storage/log/metrics/BrokerTopicMetrics.java | Centralized eager initialization logic in MeterWrapper constructor to handle metrics with only topicType tag, removed explicit meter() calls |
| storage/src/test/java/org/apache/kafka/storage/log/metrics/BrokerTopicMetricsTest.java | Added three new tests verifying eager initialization of broker-level metrics and a helper method to check registry presence |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
giuseppelillo
pushed a commit
that referenced
this pull request
Jan 27, 2026
…ag (#493) Restores the eager initialization logic for global metrics that was accidentally removed in aa045fb. Meters with only the topicType tag (e.g., diskless bytesIn/bytesOut) are broker-level metrics that should be registered immediately on construction, ensuring they are visible in monitoring systems from broker startup. Adds tests to prevent future regressions by verifying metrics are registered in the Yammer registry immediately after construction.
giuseppelillo
pushed a commit
that referenced
this pull request
Jan 27, 2026
…ag (#493) Restores the eager initialization logic for global metrics that was accidentally removed in aa045fb. Meters with only the topicType tag (e.g., diskless bytesIn/bytesOut) are broker-level metrics that should be registered immediately on construction, ensuring they are visible in monitoring systems from broker startup. Adds tests to prevent future regressions by verifying metrics are registered in the Yammer registry immediately after construction.
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.
Restores the eager initialization logic for global metrics that was accidentally removed in aa045fb. Meters with only the topicType tag (e.g., diskless bytesIn/bytesOut) are broker-level metrics that should be registered immediately on construction, ensuring they are visible in monitoring systems from broker startup.
Adds tests to prevent future regressions by verifying metrics are registered in the Yammer registry immediately after construction.