flume-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpe...@apache.org
Subject git commit: FLUME-1538. Channels should expose channel fill ratio through JMX.
Date Wed, 12 Sep 2012 20:51:13 GMT
Updated Branches:
  refs/heads/flume-1.3.0 ee25a3bc6 -> d5636f432


FLUME-1538. Channels should expose channel fill ratio through JMX.

(Hari Shreedharan via Mike Percy)


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

Branch: refs/heads/flume-1.3.0
Commit: d5636f432c4949d42f69ab56c4d1b320eeab606c
Parents: ee25a3b
Author: Mike Percy <mpercy@apache.org>
Authored: Wed Sep 12 13:48:51 2012 -0700
Committer: Mike Percy <mpercy@apache.org>
Committed: Wed Sep 12 13:50:51 2012 -0700

----------------------------------------------------------------------
 .../flume/instrumentation/ChannelCounter.java      |   10 ++++++++++
 .../flume/instrumentation/ChannelCounterMBean.java |    2 ++
 2 files changed, 12 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flume/blob/d5636f43/flume-ng-core/src/main/java/org/apache/flume/instrumentation/ChannelCounter.java
----------------------------------------------------------------------
diff --git a/flume-ng-core/src/main/java/org/apache/flume/instrumentation/ChannelCounter.java
b/flume-ng-core/src/main/java/org/apache/flume/instrumentation/ChannelCounter.java
index 602481e..9938c0a 100644
--- a/flume-ng-core/src/main/java/org/apache/flume/instrumentation/ChannelCounter.java
+++ b/flume-ng-core/src/main/java/org/apache/flume/instrumentation/ChannelCounter.java
@@ -97,8 +97,18 @@ public class ChannelCounter extends MonitoredCounterGroup implements
     set(COUNTER_CHANNEL_CAPACITY, capacity);
   }
 
+  @Override
   public long getChannelCapacity(){
     return get(COUNTER_CHANNEL_CAPACITY);
   }
 
+  @Override
+  public double getChannelFillPercentage(){
+    long capacity = getChannelCapacity();
+    if(capacity != 0L) {
+      return ((getChannelSize()/(double)capacity) * 100);
+    }
+    return Double.MAX_VALUE;
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/flume/blob/d5636f43/flume-ng-core/src/main/java/org/apache/flume/instrumentation/ChannelCounterMBean.java
----------------------------------------------------------------------
diff --git a/flume-ng-core/src/main/java/org/apache/flume/instrumentation/ChannelCounterMBean.java
b/flume-ng-core/src/main/java/org/apache/flume/instrumentation/ChannelCounterMBean.java
index f0c3ef3..9be8c3c 100644
--- a/flume-ng-core/src/main/java/org/apache/flume/instrumentation/ChannelCounterMBean.java
+++ b/flume-ng-core/src/main/java/org/apache/flume/instrumentation/ChannelCounterMBean.java
@@ -44,4 +44,6 @@ public interface ChannelCounterMBean {
   long getChannelCapacity();
 
   String getType();
+
+  double getChannelFillPercentage();
 }


Mime
View raw message