frankvicky commented on code in PR #17549:
URL: https://github.com/apache/kafka/pull/17549#discussion_r1807323514


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractMembershipManager.java:
##########
@@ -224,6 +227,12 @@ public abstract class AbstractMembershipManager<R extends 
AbstractResponse> impl
         this.clientTelemetryReporter = clientTelemetryReporter;
         this.time = time;
         this.metricsManager = metricsManager;
+
+        // Update the group member ID label in the client telemetry reporter.
+        // According to KIP-1082, the consumer will generate the member ID as 
the incarnation ID of the process.
+        // Therefore, we can update the group member ID during initialization.
+        clientTelemetryReporter.ifPresent(reporter -> 
reporter.updateMetricsLabels(
+            Collections.singletonMap(ClientTelemetryProvider.GROUP_MEMBER_ID, 
memberId)));

Review Comment:
   Originally, this logic was triggered when the consumer received the 
`memberId` assigned by the server.
   Since the consumer no longer relies on this mechanism, I moved the logic to 
the constructor.
   This also guarantees that the logic is only called once.
   



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to