[ 
https://issues.apache.org/jira/browse/KAFKA-5559?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16135535#comment-16135535
 ] 

Guozhang Wang commented on KAFKA-5559:
--------------------------------------

Hi [~onurkaraman], thanks for the comments. Just want to clarify my comments in 
the PR a bit:

1. For any Kafka clients, producer / consumer or streams, if they happen to 
have the same client ids within the same JVM, AND if the {{JMXReporter}} is 
used, an exception will be thrown, since {{JMXReporter}} uses client-id as a 
unique identifier for the mbean names. So it leaves two options for users: 
either do not use the same client id within the same JVM with {{JMXReporter}}, 
or implement your own reporter that does not throw exception. However even for 
the latter case, one can hardly distinguish two clients in their reporters 
anyways as they have the same client ids, so the best she can do is to have the 
metrics actually maintaining the aggregated values among these clients.

The original purpose of this JIRA, is to make the {{AppInfoParser}}'s behavior 
consistent with {{JMXReporter}} to throw exception instead of logging. But 
thinking about it twice as you pointed out, even with multiple clients within 
the same JVM their version / commitId should be the same, so either 
deregister-register or ignore (as is today) when the mbean already exist should 
be OK. In that sense, I think I now agree that this JIRA could be resolved as 
not an issue.

cc [~mjsax]

2. Now for Kafka Streams: the reason that we use a different client-id by 
default if users do not specify is actually more than walking around the 
{{JMXReporter}} collision issue. It is also for log4j outputs (i.e. to 
differentiate different clients), for broker-side request logs etc since that 
it is actually quite common to have one application embedded with multiple 
Streams clients for different computational logic. Note that in practice we do 
turn on TRACE to rely on the request log's client id to trouble shoot which 
client is actually behaving maliciously or is sending unexpected requests, etc. 

> Metrics should throw if two client registers with same ID
> ---------------------------------------------------------
>
>                 Key: KAFKA-5559
>                 URL: https://issues.apache.org/jira/browse/KAFKA-5559
>             Project: Kafka
>          Issue Type: Bug
>          Components: metrics
>    Affects Versions: 0.11.0.0
>            Reporter: Matthias J. Sax
>            Assignee: Matthias J. Sax
>
> Currently, {{AppInfoParser}} only logs a WARN message when a bean is 
> registered with an existing name. However, this should be treated as an error 
> and the exception should be rthrown.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to