kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jjko...@apache.org
Subject git commit: KAFKA-1425; Expose metric for LogStartOffset; reviewed by Joel Koshy and Jun Rao
Date Thu, 01 May 2014 17:16:59 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk 6b4217d19 -> 198c793ab


KAFKA-1425; Expose metric for LogStartOffset; reviewed by Joel Koshy and Jun Rao


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/198c793a
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/198c793a
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/198c793a

Branch: refs/heads/trunk
Commit: 198c793ab1f96f1fc4b46ec35aa7008335583fdc
Parents: 6b4217d
Author: Alex Couture-Beil <alex_apache@mofo.ca>
Authored: Thu May 1 10:16:28 2014 -0700
Committer: Joel Koshy <jjkoshy@gmail.com>
Committed: Thu May 1 10:16:28 2014 -0700

----------------------------------------------------------------------
 core/src/main/scala/kafka/log/Log.scala | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/198c793a/core/src/main/scala/kafka/log/Log.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/kafka/log/Log.scala b/core/src/main/scala/kafka/log/Log.scala
index f20c232..b7bc5ff 100644
--- a/core/src/main/scala/kafka/log/Log.scala
+++ b/core/src/main/scala/kafka/log/Log.scala
@@ -76,6 +76,9 @@ class Log(val dir: File,
   newGauge(name + "-" + "NumLogSegments",
            new Gauge[Int] { def value = numberOfSegments })
 
+  newGauge(name + "-" + "LogStartOffset",
+           new Gauge[Long] { def value = logStartOffset })
+
   newGauge(name + "-" + "LogEndOffset",
            new Gauge[Long] { def value = logEndOffset })
            
@@ -449,6 +452,11 @@ class Log(val dir: File,
    */
   def size: Long = logSegments.map(_.size).sum
 
+   /**
+   * The earliest message offset in the log
+   */
+  def logStartOffset: Long = logSegments.head.baseOffset
+
   /**
    *  The offset of the next message that will be appended to the log
    */


Mime
View raw message