FrankYang0529 opened a new pull request, #15502: URL: https://github.com/apache/kafka/pull/15502
The `MessageConversionsTimeMs` is calculated by `Math.round` before updating metrics, so it could be zero if it run too fast. Modify updating logic as only updating metrics if `messageConversionsTimeMs` is greater than 0. Modify unit test to check whether the metric is updated. I run the test 100 times and there is no flaky result. ``` I=1; while [ $I -le 100 ] && ./gradlew cleanTest core:test --tests MetricsTest.testMetrics; do echo "Completed run: $I"; (( I=$I+1 )); sleep 1; done ``` ### Committer Checklist (excluded from commit message) - [ ] Verify design and implementation - [ ] Verify test coverage and CI build status - [ ] Verify documentation (including upgrade notes) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org