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:03 GMT
Updated Branches:
  refs/heads/trunk 37b2b72ce -> 23bfd9ed5


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/23bfd9ed
Tree: http://git-wip-us.apache.org/repos/asf/flume/tree/23bfd9ed
Diff: http://git-wip-us.apache.org/repos/asf/flume/diff/23bfd9ed

Branch: refs/heads/trunk
Commit: 23bfd9ed585911ebf769e90252430ed15e4d018c
Parents: 37b2b72
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:48: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/23bfd9ed/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/23bfd9ed/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