This page is meant as a template for writing a KIP. To create a KIP choose Tools->Copy on this page and modify with your content and replace the heading with the next KIP number and a description of your issue. Replace anything in italics with your own description.
Current state: Under Discussion
Discussion thread: here
Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).
Currently, ProducerPerformance and ConsumerPerformance tools do not provide command line options to save final results into an output file.
It would be useful to allow users to generate performance reports in a machine-readable format, and save final results to a file. This way, results could be easily processed by external applications. To keep this KIP short and easy to review, only CSV format will be supported; other formats (such as JSON, XML, etc.) can be introduced by follow-up KIP(s).
RFC-4180 defines a formal specification of the CSV format. It allows an optional header line that contain names corresponding to the fields. In certain situations, a header line might be beneficial to Kafka users too.
Add optional arguments "output-path" and "output-with-header" to both ProducerPerformance and ConsumerPerformance with the following specification
--output-with-header Print out final results to output file with header. (default: false)
--output-path OUTPUT-PATH Write final results to the file OUTPUT-PATH.
- When "--output-path" is specified by user, final results of ProducerPerformance and ConsumerPerformance will be printed not only to the standard output but also to the given file in CSV format. An exception will be thrown if the file already exists.
- When "--output-with-header" is specified, a header record will be also printed into the output file (it will be the first line of the output). This argument only takes effect if "--output-path" is also specified.
Running ProducerPerformance tool with the following options:
will generate an output file called producer_stats.csv in CSV format:
without --output-with-header, only final results are printed
Compatibility, Deprecation, And Migration Plan
There won't be any change of current behavior. New arguments of ProducerPerformance and ConsumerPerformance are optional.
Review existing unit tests and implement new test cases that cover new functionality.
Make delimiters configurable
To limit the scope, this KIP only targets CSV output format. RFC-4180 describes the format, and it does not allow the configuration of delimiters.
Allowing users to specify other output formats (such as JSON or XML) might be beneficial in some use cases.
Overriding output file might be also useful occasionally.