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-5068: Optionally print out metrics after running the perf tests #2860

Closed
wants to merge 5 commits into from
Closed

kafka-5068: Optionally print out metrics after running the perf tests #2860

wants to merge 5 commits into from

Conversation

huxihx
Copy link
Contributor

@huxihx huxihx commented Apr 17, 2017

@junrao added a config --print.metrics to control whether ProducerPerformance prints out metrics at the end of the test. If its okay, will add the code counterpart for consumer.

Added a config `--print.metrics` to control whether ProducerPerformance prints out metrics at the end of the test.
@huxihx
Copy link
Contributor Author

huxihx commented Apr 17, 2017

The output is like this:
image

@asfbot
Copy link

asfbot commented Apr 17, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.11/2972/
Test PASSed (JDK 8 and Scala 2.11).

@asfbot
Copy link

asfbot commented Apr 17, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.10/2967/
Test PASSed (JDK 7 and Scala 2.10).

@asfbot
Copy link

asfbot commented Apr 17, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/2968/
Test PASSed (JDK 8 and Scala 2.12).

Copy link
Contributor

@junrao junrao left a comment

Choose a reason for hiding this comment

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

@Amethystic : Thanks for the patch. Looks good. Just a minor comment. It would be useful to add the same option for consumerPerf test.

int maxLengthOfDisplayName = 0;
for (Metric metric : metrics.values()) {
MetricName mName = metric.metricName();
String mergedName = mName.group() + ":" + mName.name();
Copy link
Contributor

Choose a reason for hiding this comment

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

The tags in the MetricName can be useful too. For example, for the per node metrics, it tells us the broker id.

added code to show tags and print out metrics for consumer
@huxihx
Copy link
Contributor Author

huxihx commented Apr 18, 2017

@junrao addressed your comments by adding code to display tags and print out metrics for consumer. Please review again. Thanks.

@asfbot
Copy link

asfbot commented Apr 18, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.11/2987/
Test PASSed (JDK 8 and Scala 2.11).

@asfbot
Copy link

asfbot commented Apr 18, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.10/2982/
Test PASSed (JDK 7 and Scala 2.10).

@asfbot
Copy link

asfbot commented Apr 18, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/2983/
Test PASSed (JDK 8 and Scala 2.12).

Copy link
Contributor

@junrao junrao left a comment

Choose a reason for hiding this comment

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

@Amethystic : Thanks for the patch. Looks good. Just a couple of minor comments.

for (Metric metric : metrics.values()) {
MetricName mName = metric.metricName();
System.out.println(String.format(outputFormat, mName.group() + ":" + mName.name() + ":" + mName.tags(), metric.value()));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps we can pull this code into a ToolsUtils.printMetrics(Map<MetricName, ? extends Metric> metrics) method and share between the consumerPerf and producerPerf. It would also be useful to print out the metrics in alphabetical order.

Copy link
Contributor Author

@huxihx huxihx Apr 18, 2017

Choose a reason for hiding this comment

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

kafka-client does not depend on kafka-core, so client code cannot see ToolsUtils. Do we need to create a peer helper class on client side? There is no counterpart of ConsumerPerformance in the client codebase right now

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, perhaps we can just create a util method in the tools package and use it in producerPerf. We can duplicate the code in consumerPerf for now.

@@ -223,9 +232,32 @@ private static ArgumentParser argParser() {
.dest("producerConfigFile")
.help("producer config properties file.");

parser.addArgument("--print.metrics")
Copy link
Contributor

Choose a reason for hiding this comment

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

print-metrics ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed. Always use print-metrics in both producer and consumer perf test.

1. fixed config name to 'print-metrics'
2. Add org.apache.kafka.tools.ToolsUtils#printMetrics
3. Honor alphabetical order
@huxihx
Copy link
Contributor Author

huxihx commented Apr 19, 2017

@junrao Please review again. Thanks.

@asfbot
Copy link

asfbot commented Apr 19, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.11/3009/
Test FAILed (JDK 8 and Scala 2.11).

@asfbot
Copy link

asfbot commented Apr 19, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.10/3004/
Test FAILed (JDK 7 and Scala 2.10).

@asfbot
Copy link

asfbot commented Apr 19, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/3005/
Test FAILed (JDK 8 and Scala 2.12).

@junrao
Copy link
Contributor

junrao commented Apr 19, 2017

@Amethystic : Thanks for the updated patch. Could you fix the error in style check?

@asfbot
Copy link

asfbot commented Apr 19, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.11/3015/
Test FAILed (JDK 8 and Scala 2.11).

@asfbot
Copy link

asfbot commented Apr 19, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.10/3010/
Test FAILed (JDK 7 and Scala 2.10).

@asfbot
Copy link

asfbot commented Apr 19, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/3011/
Test FAILed (JDK 8 and Scala 2.12).

@asfbot
Copy link

asfbot commented Apr 19, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.11/3016/
Test FAILed (JDK 8 and Scala 2.11).

@asfbot
Copy link

asfbot commented Apr 19, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.10/3011/
Test PASSed (JDK 7 and Scala 2.10).

@asfbot
Copy link

asfbot commented Apr 19, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/3012/
Test PASSed (JDK 8 and Scala 2.12).

@huxihx
Copy link
Contributor Author

huxihx commented Apr 19, 2017

@junrao Already passed the check. Please take a look at it again. Thanks!

@junrao
Copy link
Contributor

junrao commented Apr 19, 2017

@Amethystic : Thanks for the patch. LGTM.

@asfgit asfgit closed this in 609e9b0 Apr 19, 2017
@huxihx huxihx deleted the kafka-5068_print_metrics_in_perf_tests branch April 19, 2017 22:51
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.

3 participants