public int uncompressedBytesWritten() {
        return uncompressedRecordsSizeInBytes + batchHeaderSizeInBytes;
    }
Return the sum of the size of the batch header (always uncompressed) and the records (before compression).
clients/src/main/java/org/apache/kafka/common/record/MemoryRecordsBuilder.java