[ https://issues.apache.org/jira/browse/KAFKA-19543?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18010967#comment-18010967 ]
Kirk True commented on KAFKA-19543: ----------------------------------- [~mjsax]—should the map returned from {{metrics()}} represent a _snapshot_ of the metrics at the point in time it's called, or should it reflect _ongoing_ changes? The current behavior is the latter. Because of KAFKA-19542, _some_ of the metrics are present in the Map, post-{{close()}}, but not _all_, which is confusing to the user. So the fact that metrics will be empty on {{close()}} should be documented in the API. > The set of metrics returned from Consumer.metrics() changes after > Consumer.close() > ---------------------------------------------------------------------------------- > > Key: KAFKA-19543 > URL: https://issues.apache.org/jira/browse/KAFKA-19543 > Project: Kafka > Issue Type: Bug > Components: clients, consumer, metrics > Affects Versions: 4.1.0 > Reporter: Kirk True > Assignee: Kirk True > Priority: Minor > > metrics() reflects the current state, so if you get the metrics before you > close and then look at them afterward, some of the metrics are missing > because some were removed. -- This message was sent by Atlassian Jira (v8.20.10#820010)