kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jun...@apache.org
Subject svn commit: r1177798 - in /incubator/kafka/trunk/core/src/main/scala/kafka: message/FileMessageSet.scala network/SocketServerStats.scala utils/Utils.scala
Date Fri, 30 Sep 2011 19:36:08 GMT
Author: junrao
Date: Fri Sep 30 19:36:07 2011
New Revision: 1177798

URL: http://svn.apache.org/viewvc?rev=1177798&view=rev
Log:
Expose total metrics through MBeansp; patched by Pierre-Yves Ritschard; reviewed by Jun Rao;
KAFKA-140

Modified:
    incubator/kafka/trunk/core/src/main/scala/kafka/message/FileMessageSet.scala
    incubator/kafka/trunk/core/src/main/scala/kafka/network/SocketServerStats.scala
    incubator/kafka/trunk/core/src/main/scala/kafka/utils/Utils.scala

Modified: incubator/kafka/trunk/core/src/main/scala/kafka/message/FileMessageSet.scala
URL: http://svn.apache.org/viewvc/incubator/kafka/trunk/core/src/main/scala/kafka/message/FileMessageSet.scala?rev=1177798&r1=1177797&r2=1177798&view=diff
==============================================================================
--- incubator/kafka/trunk/core/src/main/scala/kafka/message/FileMessageSet.scala (original)
+++ incubator/kafka/trunk/core/src/main/scala/kafka/message/FileMessageSet.scala Fri Sep 30
19:36:07 2011
@@ -257,6 +257,7 @@ class FileMessageSet private[kafka](priv
 trait LogFlushStatsMBean {
   def getFlushesPerSecond: Double
   def getAvgFlushMs: Double
+  def getTotalFlushMs: Long
   def getMaxFlushMs: Double
   def getNumFlushes: Long
 }
@@ -271,6 +272,8 @@ class LogFlushStats extends LogFlushStat
 
   def getAvgFlushMs: Double = flushRequestStats.getAvgMetric
 
+  def getTotalFlushMs: Long = flushRequestStats.getTotalMetric
+
   def getMaxFlushMs: Double = flushRequestStats.getMaxMetric
 
   def getNumFlushes: Long = flushRequestStats.getNumRequests

Modified: incubator/kafka/trunk/core/src/main/scala/kafka/network/SocketServerStats.scala
URL: http://svn.apache.org/viewvc/incubator/kafka/trunk/core/src/main/scala/kafka/network/SocketServerStats.scala?rev=1177798&r1=1177797&r2=1177798&view=diff
==============================================================================
--- incubator/kafka/trunk/core/src/main/scala/kafka/network/SocketServerStats.scala (original)
+++ incubator/kafka/trunk/core/src/main/scala/kafka/network/SocketServerStats.scala Fri Sep
30 19:36:07 2011
@@ -33,6 +33,10 @@ trait SocketServerStatsMBean {
   def getBytesWrittenPerSecond: Double
   def getNumFetchRequests: Long
   def getNumProduceRequests: Long
+  def getTotalBytesRead: Long
+  def getTotalBytesWritten: Long
+  def getTotalFetchRequestMs: Long
+  def getTotalProduceRequestMs: Long
 }
 
 @threadsafe
@@ -77,4 +81,12 @@ class SocketServerStats(val monitorDurat
   def getNumFetchRequests: Long = fetchTimeStats.getNumRequests
 
   def getNumProduceRequests: Long = produceTimeStats.getNumRequests
+
+  def getTotalBytesRead: Long = produceBytesStats.getTotalMetric
+
+  def getTotalBytesWritten: Long = fetchBytesStats.getTotalMetric
+
+  def getTotalFetchRequestMs: Long = fetchTimeStats.getTotalMetric
+
+  def getTotalProduceRequestMs: Long = produceTimeStats.getTotalMetric
 }

Modified: incubator/kafka/trunk/core/src/main/scala/kafka/utils/Utils.scala
URL: http://svn.apache.org/viewvc/incubator/kafka/trunk/core/src/main/scala/kafka/utils/Utils.scala?rev=1177798&r1=1177797&r2=1177798&view=diff
==============================================================================
--- incubator/kafka/trunk/core/src/main/scala/kafka/utils/Utils.scala (original)
+++ incubator/kafka/trunk/core/src/main/scala/kafka/utils/Utils.scala Fri Sep 30 19:36:07
2011
@@ -600,11 +600,13 @@ class SnapshotStats(private val monitorD
 
   private val complete = new AtomicReference(new Stats())
   private val current = new AtomicReference(new Stats())
+  private val total = new AtomicLong(0)
   private val numCumulatedRequests = new AtomicLong(0)
 
   def recordRequestMetric(requestNs: Long) {
     val stats = current.get
     stats.add(requestNs)
+    total.getAndAdd(requestNs)
     numCumulatedRequests.getAndAdd(1)
     val ageNs = time.nanoseconds - stats.start
     // if the current stats are too old it is time to swap
@@ -653,6 +655,8 @@ class SnapshotStats(private val monitorD
     }
   }
 
+  def getTotalMetric: Long = total.get
+
   def getMaxMetric: Double = complete.get.maxRequestMetric
 
   class Stats {



Mime
View raw message