You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "alexcb (JIRA)" <ji...@apache.org> on 2014/04/26 00:27:17 UTC
[jira] [Created] (KAFKA-1425) provide logStartOffset in addition to
LogEndOffset metric
alexcb created KAFKA-1425:
-----------------------------
Summary: 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
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)