[ 
https://issues.apache.org/jira/browse/KAFKA-1425?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

alexcb updated KAFKA-1425:
--------------------------

    Attachment: add-start-offset-to-kafka.patch

> provide logStartOffset in addition to LogEndOffset metric
> ---------------------------------------------------------
>
>                 Key: KAFKA-1425
>                 URL: https://issues.apache.org/jira/browse/KAFKA-1425
>             Project: Kafka
>          Issue Type: Improvement
>            Reporter: alexcb
>            Priority: Minor
>         Attachments: add-start-offset-to-kafka.patch
>
>
> Hello,
> Would it be possible to include a metric to report the minimum message offset 
> for each topic/partition? This would mirror the LogEndOffset which is already 
> provided.
> There's also a Size metric that's provided; however, this gives us the size 
> of a topic/partition in bytes so I'm unable to calculate the 
> Starting/beginning message offset based on the end offset.
> Thanks,
> Alex
> Here's an initial patch which I have used against 0.8.1:
> --- kafka-0.8.1-src/core/src/main/scala/kafka/log/Log.scala   2014-04-25 
> 09:53:00.252614353 -0700
> +++ kafka-0.8.1-src-patch/core/src/main/scala/kafka/log/Log.scala     
> 2014-04-25 11:38:32.610614193 -0700
> @@ -76,6 +76,15 @@
>    newGauge(name + "-" + "LogEndOffset",
>             new Gauge[Long] { def value = logEndOffset })
>  
> +  newGauge(name + "-" + "logStartOffset",
> +           new Gauge[Long] { def value = logStartOffset })
> +
>    /** The name of this log */
>    def name  = dir.getName()
>  
> @@ -421,6 +430,11 @@
>    def size: Long = logSegments.map(_.size).sum
>  
>    /**
> +   * The earliest message offset in the log
> +   */
> +  def logStartOffset: Long = logSegments.map(_.baseOffset).min
> +
> +  /**
>     *  The offset of the next message that will be appended to the log
>     */
>    def logEndOffset: Long = nextOffset.get



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to