fgeller / kt

Kafka command line tool that likes JSON
MIT License
950 stars 100 forks source link

Non-zero exit code in case of warnings #140

Open mibollma opened 1 year ago

mibollma commented 1 year ago

I think it would be useful to return a non-zero exit code in case kt encountered a warning while reading data from topics either by default or only when enabled with an additional flag.

In my specific case while I am reading topic partition offsets I sometimes encounter warnings such as

failed to read info for topic ***. err=kafka server: In the middle of a leadership election, there is currently no leader for this partition and hence it is unavailable for writes. Source

In that case the topic is skipped and the data for this topic is missing in the result. If kt would return a non-zero exit code I could retry a few times with some delay until hopefully the leadership election is done.

@fgeller I can offer to give the implementation a shot if there is general interest to merge such a feature into master