[ https://issues.apache.org/jira/browse/KAFKA-2993?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15103660#comment-15103660 ]
ASF GitHub Bot commented on KAFKA-2993: --------------------------------------- GitHub user xiaotao183 opened a pull request: https://github.com/apache/kafka/pull/784 KAFKA-2993: Calculate compression rate at close() call Buffer is rewound before the compression rate metric is updated which results in 0 compress rate. The fix is to include a new compressRate field to record the latest compression rate in ```close()``` and return it to sensor You can merge this pull request into a Git repository by running: $ git pull https://github.com/xiaotao183/kafka kafka-2993 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/kafka/pull/784.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 #784 ---- commit 77fae49f294009f432ad7e3158592b5a02c3a61a Author: Xiao, Tao <tax...@ebay.com> Date: 2016-01-17T11:04:54Z Fixed KAFKA-2993 - Keep reference to compression rate instead of computing at runtime ---- > compression-rate-avg always returns 0 even with compression.type being set > -------------------------------------------------------------------------- > > Key: KAFKA-2993 > URL: https://issues.apache.org/jira/browse/KAFKA-2993 > Project: Kafka > Issue Type: Bug > Affects Versions: 0.9.0.0 > Reporter: TAO XIAO > Assignee: TAO XIAO > Priority: Minor > > The producer metric compression-rate-avg always returns 0 even with > compression.type set to snappy. I drilled down the code and discovered that > the position of bytebuffer in org.apache.kafka.common.record.Compressor is > reset to 0 by RecordAccumulator.drain() before calling metric updates in > sender thread. -- This message was sent by Atlassian JIRA (v6.3.4#6332)