GitHub user wushujames opened a pull request: https://github.com/apache/kafka/pull/3967
KAFKA-5951: Autogenerate Producer RecordAccumulator metrics Don't review this until https://github.com/apache/kafka/pull/3799/files is merged. This PR layers on top of https://github.com/apache/kafka/pull/3799/files. This will have to be rebased, once https://github.com/apache/kafka/pull/3799/files is merged into trunk and 1.0.0 You can merge this pull request into a Git repository by running: $ git pull https://github.com/wushujames/kafka producer_record_accumulator_bufferpool Alternatively you can review and apply these changes as the patch at: https://github.com/apache/kafka/pull/3967.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #3967 ---- commit 7b48ab7030c58879103bccf8c3f7dff59444a6a6 Author: James Cheng <jylch...@yahoo.com> Date: 2017-09-06T07:23:23Z Instead of having the metrics registry and the org.apache.kafka.common.metrics.Metrics object be separate things, have the metrics registry hold a copy of the Metrics object. That way, all the metricInstance stuff is hidden, and we don't have to make sure they are configured identicailly (with the same tags). commit f8cd817fa3faefb4cf0bd482dce9d6627ee5b84e Author: James Cheng <jylch...@yahoo.com> Date: 2017-09-17T07:40:25Z Merge remote-tracking branch 'origin/trunk' into producer_sender_metrics_docs_different Conflicts: clients/src/main/java/org/apache/kafka/clients/producer/internals/Sender.java clients/src/main/java/org/apache/kafka/clients/producer/internals/SenderMetricsRegistry.java clients/src/test/java/org/apache/kafka/clients/producer/internals/SenderTest.java commit 3a11a7bfc2d2e37b769019326555a42051b554ad Author: James Cheng <jylch...@yahoo.com> Date: 2017-09-17T08:22:08Z Fix merge errors. Change public metrics to private, since they all have getters now. Simplify the Sender.throttleTimeSensor() static method to just use the metrics registry. commit b3e739f87a74f1d10c9bdfd712d2506848dd69dd Author: James Cheng <jylch...@yahoo.com> Date: 2017-09-17T08:24:39Z Missed this change, when I switched metrics accces to private. commit 9893002e9d4f95ebcbf94922b5b0897b79d582d2 Author: James Cheng <jylch...@yahoo.com> Date: 2017-09-19T05:24:23Z Merge remote-tracking branch 'origin/trunk' into producer_sender_metrics_docs_different commit 9014654f1b74f8e19365e1478fb92b13cfe2abd6 Author: James Cheng <jylch...@yahoo.com> Date: 2017-09-19T05:33:42Z Update test case to accomodate new registry design. commit 4adc64e8fb48866cbb9fc8a9ba4a3304968b844e Author: James Cheng <jylch...@yahoo.com> Date: 2017-09-19T05:49:32Z Automatically put all the MetricNameTemplates into a list, which is used for documentation. commit f9fb34586955d98e30e37b8fc79fb0433319ef51 Author: James Cheng <jylch...@yahoo.com> Date: 2017-09-21T05:38:11Z Get rid of the getters, for all the metrics without additional tags. Precompute the MetricNames in advance. Expose those MetricNames as public variables to all the people who need it. commit a6ee2efac0ed7ce8d5d9b1f0e04058855aaaff25 Author: James Cheng <jylch...@yahoo.com> Date: 2017-09-21T05:48:27Z Inline access to the metrics, where possible and readable. commit d40ffc1c54b2cd303a318587cb93f5d3000e8309 Author: James Cheng <jylch...@yahoo.com> Date: 2017-09-21T05:51:49Z Make instance variables final. commit 763035ad3120232140f8861038b56de108a75b49 Author: James Cheng <jylch...@yahoo.com> Date: 2017-09-21T06:01:57Z Change another variable to final commit c4e87e757b9f64fa28afcbe08190739fc3ff80b4 Author: James Cheng <jylch...@yahoo.com> Date: 2017-09-21T06:04:51Z Merge remote-tracking branch 'origin/trunk' into producer_sender_metrics_docs_different_2 commit d4542de643123a9fe734b2e0cc5cac11dfce7ec5 Author: James Cheng <jylch...@yahoo.com> Date: 2017-09-21T07:42:31Z Merge remote-tracking branch 'origin/trunk' into producer_sender_metrics_docs_different commit 3f306488a4101f63da5587655e332332c952e30c Author: James Cheng <jylch...@yahoo.com> Date: 2017-09-22T06:10:04Z Add empty RecordAccumulatorMetricsRegistry commit 4447f53babf67f6e51a3f908107f509fb085fecf Author: James Cheng <jylch...@yahoo.com> Date: 2017-09-22T06:34:40Z RecordAccumulator now takes a metrics registry commit 49ba8c6c52b0a34008f513e9af7867d09d3d53d2 Author: James Cheng <jylch...@yahoo.com> Date: 2017-09-22T06:54:02Z Switch RecordAccumulator to use the metrics registry. commit 0ce13cbae54587878cbf473f67cad21a528ec6ff Author: James Cheng <jylch...@yahoo.com> Date: 2017-09-22T06:57:01Z Removed unused parameters commit 76b7c85c5d45911e01e684098dc73acc524eb2c2 Author: James Cheng <jylch...@yahoo.com> Date: 2017-09-22T07:07:50Z Extract stuff out to a base class commit a8dc5e5d7cd99d954fa550866efd34a16e1f1177 Author: James Cheng <jylch...@yahoo.com> Date: 2017-09-22T07:10:40Z Fix checkstyle warnings. commit ff35eb6a899ea1d9f6bdd97f80fa15fe988f9507 Author: James Cheng <jylch...@yahoo.com> Date: 2017-09-22T07:14:20Z Create empty BufferPoolMetricsRegistry commit 328521ef5f2bbeec8023133ceedaaf7c445ed471 Author: James Cheng <jylch...@yahoo.com> Date: 2017-09-22T07:27:34Z Hook in an empty metrics registry commit a9059bd8538b7abc4b02e0885a8cf59d0a642ead Author: James Cheng <jylch...@yahoo.com> Date: 2017-09-22T07:37:09Z Switch BufferPool metrics over to the registry commit c7239a5aac819c32215b7a17527b3015211a4238 Author: James Cheng <jylch...@yahoo.com> Date: 2017-09-22T07:38:30Z Rename variable commit 5e67e50dda50cfe253ddcb3aac924ff7257aad6d Author: James Cheng <jylch...@yahoo.com> Date: 2017-09-22T07:46:48Z Return BufferPool metrics, so that they can be auto generated commit eb0f56c5ba543828e013792b414021ff07052c37 Author: James Cheng <jylch...@yahoo.com> Date: 2017-09-22T08:11:41Z Remove unused parameters commit 0d3728c91292b8ead979015e82c17faf5ad465a2 Author: James Cheng <jylch...@yahoo.com> Date: 2017-09-22T08:13:42Z Remove another unused parameter commit 1c1ee7afefa7cb54eb5a5c8bc88d580e4bdf350c Author: James Cheng <jylch...@yahoo.com> Date: 2017-09-22T08:23:06Z Remove another unused parameter commit 58572fdfd1a0ed410913389b3eee6dc4e458093a Author: James Cheng <jylch...@yahoo.com> Date: 2017-09-22T08:42:43Z Remove producer metrics table from the docs, since we are now auto-generating it. commit 9117f575a72561b4d0f7b84d9fa0eeb3911ff10a Author: James Cheng <jylch...@yahoo.com> Date: 2017-09-22T08:58:15Z Merge remote-tracking branch 'origin/trunk' into producer_sender_metrics_docs_different commit 6d60492ceb68e44de9d88c3ffcadbe1d1eb36560 Author: James Cheng <jylch...@yahoo.com> Date: 2017-09-26T23:20:09Z These variables never change, so declare them as final. ---- ---