-
Notifications
You must be signed in to change notification settings - Fork 65
[LI-HOTFIX] Add debugger to print resolved IPs, and assign clientId to ProducerConfig #352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -111,6 +111,10 @@ public static ChannelBuilder createChannelBuilder(AbstractConfig config, Time ti | |
|
|
||
| static List<InetAddress> resolve(String host, ClientDnsLookup clientDnsLookup) throws UnknownHostException { | ||
| InetAddress[] addresses = InetAddress.getAllByName(host); | ||
| log.debug("Resolved {} and got addresses: ", host); | ||
| for (InetAddress address: addresses) { | ||
| log.debug(address.getHostAddress() + ";"); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this getHostAddress prints the actual resolved host name, not the bootstrap dns disco address, right?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. getHostAddress returns the IP address string in textual presentation. |
||
| } | ||
| if (ClientDnsLookup.USE_ALL_DNS_IPS == clientDnsLookup) { | ||
| return filterPreferredAddresses(addresses); | ||
| } else { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -331,13 +331,20 @@ public KafkaProducer(Properties properties, Serializer<K> keySerializer, Seriali | |
| valueSerializer)); | ||
| try { | ||
| Map<String, Object> userProvidedConfigs = config.originals(); | ||
| this.producerConfig = config; | ||
| this.time = time; | ||
|
|
||
| String transactionalId = userProvidedConfigs.containsKey(ProducerConfig.TRANSACTIONAL_ID_CONFIG) ? | ||
| (String) userProvidedConfigs.get(ProducerConfig.TRANSACTIONAL_ID_CONFIG) : null; | ||
|
|
||
| this.clientId = buildClientId(config.getString(ProducerConfig.CLIENT_ID_CONFIG), transactionalId); | ||
| String configuredClientId = config.getString(ProducerConfig.CLIENT_ID_CONFIG); | ||
|
|
||
| this.clientId = buildClientId(configuredClientId, transactionalId); | ||
|
|
||
| if (configuredClientId.isEmpty()) { | ||
| config.originals().put(ProducerConfig.CLIENT_ID_CONFIG, this.clientId); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what's the usage for this? If user didn't supply a client.id, the printed configs will have client.id as empty field?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, when users didn't config client.id, kafka clients will self generate it and the ProducerConfig values result will be: client.id = |
||
| } | ||
|
|
||
| this.producerConfig = config; | ||
|
|
||
| LogContext logContext; | ||
| if (transactionalId == null) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: you'll need to follow the pr format for kafka repos, similar to #329
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, modified the format. Lemme know if further adjustment is needed.