Skip to content
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

KAFKA-6069: Properly tag KafkaStreams metrics with the client id. #4081

Closed
wants to merge 1 commit into from

Conversation

twbecker
Copy link
Contributor

No description provided.

@tedyu
Copy link
Contributor

tedyu commented Oct 17, 2017

lgtm

@bbejeck
Copy link
Contributor

bbejeck commented Oct 17, 2017

Thanks for the patch @twbecker. It would be nice to have a test for this, but there doesn't seem to be a reasonable approach ATM. LGTM.

@guozhangwang
Copy link
Contributor

This is a great catch, thanks @twbecker !

Maybe you can take a look at StreamThreadTest#testMetrics and see if we can do the same for StreamsKafkaClient metrics validations?

@twbecker
Copy link
Contributor Author

@guozhangwang Gave it a shot.

static final Map<MetricName, KafkaMetric> METRICS = new HashMap<>();

@Override
public void configure(Map<String, ?> configs) { }
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: make parameter final. Same for other test methods.

@bbejeck
Copy link
Contributor

bbejeck commented Oct 17, 2017

Thanks, @twbecker left some comments.

public void configure(final Map<String, ?> configs) { }

@Override
public void init(List<KafkaMetric> metrics) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: final for parameter here


@Override
public void init(List<KafkaMetric> metrics) {
for (KafkaMetric metric : metrics) {
Copy link
Contributor

Choose a reason for hiding this comment

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

final here as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It never occurs to me to sprinkle these finals everywhere ;) If this is the standard, might I humbly suggest that Checkstyle be configured to enforce it? Would probably save both reviewers and contributors some time.

StreamsKafkaClient.create(new StreamsConfig(config));
assertFalse(TestMetricsReporter.METRICS.isEmpty());
for (KafkaMetric kafkaMetric : TestMetricsReporter.METRICS.values()) {
assertEquals("some_client_id", kafkaMetric.metricName().tags().get("client-id"));
Copy link
Contributor

Choose a reason for hiding this comment

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

Since just one value to check do we need the for loop?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are ~30 metrics registered at this point. I'm just asserting that they are all tagged with the proper client id, rather than how many there are.

@bbejeck
Copy link
Contributor

bbejeck commented Oct 18, 2017

@twbecker thanks for following up. Left some minor comments, otherwise LGTM.

@twbecker
Copy link
Contributor Author

Addressed comments and rebased, since there's been some churn.

@bbejeck
Copy link
Contributor

bbejeck commented Oct 19, 2017

ping @guozhangwang @dguy for final review and merging.

Copy link
Contributor

@dguy dguy left a comment

Choose a reason for hiding this comment

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

Thanks @twbecker, LGTM

asfgit pushed a commit that referenced this pull request Oct 19, 2017
Author: Tommy Becker <tobecker@tivo.com>

Reviewers: Bill Bejeck <bill@confluent.io>, Damian Guy <damian.guy@gmail.com>

Closes #4081 from twbecker/KAFKA-6069

(cherry picked from commit 249e398)
Signed-off-by: Damian Guy <damian.guy@gmail.com>
@dguy
Copy link
Contributor

dguy commented Oct 19, 2017

merged to trunk and 1.0

@asfgit asfgit closed this in 249e398 Oct 19, 2017
@bbejeck
Copy link
Contributor

bbejeck commented Oct 19, 2017

Thanks @dguy

jeqo pushed a commit to jeqo/kafka that referenced this pull request Nov 16, 2017
Author: Tommy Becker <tobecker@tivo.com>

Reviewers: Bill Bejeck <bill@confluent.io>, Damian Guy <damian.guy@gmail.com>

Closes apache#4081 from twbecker/KAFKA-6069
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants