Status
Current state: Under Discussion
Discussion thread: here
JIRA: here
Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).
Motivation
When running kafka-metadata-quorum script to get the quorum replication status, the LastFetchTimestamp and LastCaughtUpTimestamp output is not human-readable.
I will be convenient to add an optional flag (-hr, --human-readable) to enable a human-readable format showing the delay in ms (i.e. 366 ms ago).
Public Interfaces
A new optional flag called --human-readable with the shortcut -hr will be added to the kafka-metadata-quorum tool.
$ bin/kafka-metadata-quorum.sh -h usage: kafka-metadata-quorum [-h] --bootstrap-server BOOTSTRAP_SERVER [--command-config COMMAND_CONFIG] [-hr] {describe} ... This tool describes kraft metadata quorum status. positional arguments: {describe} describe Describe the metadata quorum info optional arguments: -h, --help show this help message and exit --bootstrap-server BOOTSTRAP_SERVER A comma-separated list of host:port pairs to use for establishing the connection to the Kafka cluster. --command-config COMMAND_CONFIG Property file containing configs to be passed to Admin Client. -hr, --human-readable Print human-readable timestamps (default: false)
Proposed Changes
The current default output is as follows and will remain unchanged.
$ bin/kafka-metadata-quorum.sh --bootstrap-server :9092 describe --replication NodeId LogEndOffset Lag LastFetchTimestamp LastCaughtUpTimestamp Status 2 551 0 1683732558012 1683732558012 Leader 3 551 0 1683732557573 1683732557573 Follower 4 551 0 1683732557573 1683732557573 Follower
Instead, when passing the new flag, we will have the following output.
$ bin/kafka-metadata-quorum.sh --bootstrap-server :9092 -hr describe --replication NodeId LogEndOffset Lag LastFetchTimestamp LastCaughtUpTimestamp Status 2 541 0 3 ms ago 3 ms ago Leader 3 541 0 366 ms ago 366 ms ago Follower 4 541 0 366 ms ago 366 ms ago Follower $ bin/kafka-metadata-quorum.sh --bootstrap-server :9092 --human-readable describe --replication NodeId LogEndOffset Lag LastFetchTimestamp LastCaughtUpTimestamp Status 2 541 0 3 ms ago 3 ms ago Leader 3 541 0 366 ms ago 366 ms ago Follower 4 541 0 366 ms ago 366 ms ago Follower
Compatibility, Deprecation, and Migration Plan
The default behavior will remain unchanged to avoid breaking any tool relying on the current timestamp format.
Test Plan
A new test method will be added to MetadataQuorumCommandTest to verify default and new behaviors with regard to the timestamp format.
Rejected Alternatives
Using a date/time formatting (i.e. May 10, 15:54:55 UTC) won't add much information in most cases.