Skip to content

KAFKA-8855; Collect and Expose Client's Name and Version in the Brokers (KIP-511 Part 2)#7749

Merged
cmccabe merged 4 commits intoapache:trunkfrom
dajac:kafka-8855-collect-client-name-and-version-2-part2-version2
Dec 13, 2019
Merged

KAFKA-8855; Collect and Expose Client's Name and Version in the Brokers (KIP-511 Part 2)#7749
cmccabe merged 4 commits intoapache:trunkfrom
dajac:kafka-8855-collect-client-name-and-version-2-part2-version2

Conversation

@dajac
Copy link
Copy Markdown
Member

@dajac dajac commented Nov 26, 2019

More detailed description of your change,
if necessary. The PR title and PR message become
the squashed commit message, so use a separate
comment to ping reviewers.

Summary of testing strategy (including rationale)
for the feature or bug fix. Unit and/or integration
tests are expected for any behaviour change and
system tests should be considered for larger changes.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

Comment thread clients/src/main/java/org/apache/kafka/common/metrics/IntGaugeSuite.java Outdated
@dajac dajac marked this pull request as ready for review November 26, 2019 16:41
Comment thread core/src/main/scala/kafka/network/SocketServer.scala Outdated
@dajac
Copy link
Copy Markdown
Member Author

dajac commented Nov 28, 2019

retest this please

@dajac dajac force-pushed the kafka-8855-collect-client-name-and-version-2-part2-version2 branch 2 times, most recently from fb38365 to e8964fd Compare December 9, 2019 09:54
@dajac dajac force-pushed the kafka-8855-collect-client-name-and-version-2-part2-version2 branch from e8964fd to 0339513 Compare December 9, 2019 09:56
@dajac
Copy link
Copy Markdown
Member Author

dajac commented Dec 9, 2019

retest this please

@cmccabe
Copy link
Copy Markdown
Contributor

cmccabe commented Dec 10, 2019

Hi @dajac , thanks for this PR! It looks good.

Do we really need to special-case the SASL case? In the case of SASL, the first ApiVersionsRequest that gets sent is a v0 request which will never have the client information on it anyway, right? It would just be nice if we didn't have to alter the Authenticator interface, but maybe there's something I'm not thinking through.

@dajac
Copy link
Copy Markdown
Member Author

dajac commented Dec 10, 2019

Do we really need to special-case the SASL case? In the case of SASL, the first ApiVersionsRequest that gets sent is a v0 request which will never have the client information on it anyway, right? It would just be nice if we didn't have to alter the Authenticator interface, but maybe there's something I'm not thinking through.

Unfortunately, all the clients out there are not equal when it comes to the handling of the ApiVersionsRequest. As you said, with SASL, the java client sends a v0 request which will never have the client information (and sends a second one to provide it). On the other hand, librdkafka always sends only one AVR (latest version) thus we must handle it in the SASL handshake.

It is really unfortunate but we don't have the choice if we want to support the whole variety of clients out there. Long term, we should aim for having one mandatory AVR in all cases at the beginning of the connection but this is hard now because the AVR is not mandatory.

@dajac
Copy link
Copy Markdown
Member Author

dajac commented Dec 10, 2019

retest this please

1 similar comment
@dajac
Copy link
Copy Markdown
Member Author

dajac commented Dec 10, 2019

retest this please

@cmccabe
Copy link
Copy Markdown
Contributor

cmccabe commented Dec 11, 2019

@dajac : I think we're starting to create too many links between unrelated classes here. We need some separation of concerns. Rather than creating links between all these classes, we should just have a general metrics registry that can be modified from several places.

It was kind of complicated to explain to explain what I meant, so I wrote a change and posted it here: dajac#1. Take a look and let me know what you think!

@cmccabe
Copy link
Copy Markdown
Contributor

cmccabe commented Dec 11, 2019

See dajac#1

@dajac
Copy link
Copy Markdown
Member Author

dajac commented Dec 12, 2019

@cmccabe Thank you for the suggestion. Interestingly, I prototyped something similar but I thought it was too much just for the ClientInformation. Considering the CipherInformation which has been merged in between, I think that you are right, and that it makes sense to have such registry. I will update the PR based on yours.

@dajac
Copy link
Copy Markdown
Member Author

dajac commented Dec 12, 2019

@cmccabe I have merged part of your PR in mine and reworked things a little. I have made the following changes:

  • I propose to use ChannelMetadataRegistry instead of ChannelMetricRegistry. The metrics are more a side effect of the metadata collection.
  • I am not keen in exposing the registry in the RequestContext as it may tempt people to mutate the information in other places (e.g. api layer). I think it is preferable to put the information required in the RequestContext directly. What do you think?
  • I have enhanced the unit tests a bit.

Comment thread clients/src/main/java/org/apache/kafka/common/network/Selector.java Outdated
Comment thread clients/src/main/java/org/apache/kafka/common/network/Selector.java
Comment thread clients/src/main/java/org/apache/kafka/common/network/Selector.java
Comment thread clients/src/test/java/org/apache/kafka/common/network/SelectorTest.java Outdated
Comment thread core/src/main/scala/kafka/network/RequestChannel.scala Outdated
channel.channelMetadataRegistry.clientInformation)
val req = new RequestChannel.Request(processor = id, context = context,
startTimeNanos = nowNanos, memoryPool, receive.payload, requestChannel.metrics)
if (header.apiKey == ApiKeys.API_VERSIONS) {
Copy link
Copy Markdown
Contributor

@cmccabe cmccabe Dec 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good to include a short reference to kip-511 in a comment here

@dajac
Copy link
Copy Markdown
Member Author

dajac commented Dec 13, 2019

@cmccabe Thanks for the review. I have addressed your comments.

@cmccabe
Copy link
Copy Markdown
Contributor

cmccabe commented Dec 13, 2019

LGTM. Thanks, @dajac

@cmccabe cmccabe merged commit ae38315 into apache:trunk Dec 13, 2019
@dajac
Copy link
Copy Markdown
Member Author

dajac commented Dec 13, 2019

I’ll update the KIP on Monday to reflect the implementation.

@dajac dajac deleted the kafka-8855-collect-client-name-and-version-2-part2-version2 branch October 6, 2020 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants