HBASE-1258,1259 ganglia metrics for 'requests' is confusing
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@753602 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e8520cf5d3
commit
ed32441b0c
|
@ -95,6 +95,8 @@ Release 0.20.0 - Unreleased
|
|||
HBASE-803 Atomic increment operations (Ryan Rawson and Jon Gray via Stack)
|
||||
HBASE-1252 Make atomic increment perform a binary increment
|
||||
(Jonathan Gray via Stack)
|
||||
HBASE-1258,1259 ganglia metrics for 'requests' is confusing
|
||||
(Ryan Rawson via Stack)
|
||||
|
||||
Release 0.19.0 - 01/21/2009
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -22,6 +22,7 @@ import java.lang.management.MemoryUsage;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.hbase.metrics.MetricsRate;
|
||||
import org.apache.hadoop.hbase.util.Strings;
|
||||
import org.apache.hadoop.metrics.MetricsContext;
|
||||
import org.apache.hadoop.metrics.MetricsRecord;
|
||||
|
@ -29,6 +30,7 @@ import org.apache.hadoop.metrics.MetricsUtil;
|
|||
import org.apache.hadoop.metrics.Updater;
|
||||
import org.apache.hadoop.metrics.jvm.JvmMetrics;
|
||||
import org.apache.hadoop.metrics.util.MetricsIntValue;
|
||||
import org.apache.hadoop.metrics.util.MetricsTimeVaryingRate;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -47,34 +49,34 @@ public class RegionServerMetrics implements Updater {
|
|||
/**
|
||||
* Count of regions carried by this regionserver
|
||||
*/
|
||||
public final MetricsIntValue regions = new MetricsIntValue("regions");
|
||||
public final MetricsIntValue regions = new MetricsIntValue("hbase_regions");
|
||||
|
||||
/*
|
||||
* Count of requests to the regionservers since last call to metrics update
|
||||
*/
|
||||
private final MetricsIntValue requests = new MetricsIntValue("requests");
|
||||
private final MetricsRate requests = new MetricsRate("hbase_requests");
|
||||
|
||||
/**
|
||||
* Count of stores open on the regionserver.
|
||||
*/
|
||||
public final MetricsIntValue stores = new MetricsIntValue("stores");
|
||||
public final MetricsIntValue stores = new MetricsIntValue("hbase_stores");
|
||||
|
||||
/**
|
||||
* Count of storefiles open on the regionserver.
|
||||
*/
|
||||
public final MetricsIntValue storefiles = new MetricsIntValue("storefiles");
|
||||
public final MetricsIntValue storefiles = new MetricsIntValue("hbase_storefiles");
|
||||
|
||||
/**
|
||||
* Sum of all the storefile index sizes in this regionserver in MB
|
||||
*/
|
||||
public final MetricsIntValue storefileIndexSizeMB =
|
||||
new MetricsIntValue("storefileIndexSizeMB");
|
||||
new MetricsIntValue("hbase_storefileIndexSizeMB");
|
||||
|
||||
/**
|
||||
* Sum of all the memcache sizes in this regionserver in MB
|
||||
*/
|
||||
public final MetricsIntValue memcacheSizeMB =
|
||||
new MetricsIntValue("memcachSizeMB");
|
||||
new MetricsIntValue("hbase_memcacheSizeMB");
|
||||
|
||||
public RegionServerMetrics() {
|
||||
MetricsContext context = MetricsUtil.getContext("hbase");
|
||||
|
@ -102,11 +104,7 @@ public class RegionServerMetrics implements Updater {
|
|||
this.storefileIndexSizeMB.pushMetric(this.metricsRecord);
|
||||
this.memcacheSizeMB.pushMetric(this.metricsRecord);
|
||||
this.regions.pushMetric(this.metricsRecord);
|
||||
synchronized(this.requests) {
|
||||
this.requests.pushMetric(this.metricsRecord);
|
||||
// Set requests down to zero again.
|
||||
this.requests.set(0);
|
||||
}
|
||||
}
|
||||
this.metricsRecord.update();
|
||||
this.lastUpdate = System.currentTimeMillis();
|
||||
|
@ -119,18 +117,16 @@ public class RegionServerMetrics implements Updater {
|
|||
/**
|
||||
* @return Count of requests.
|
||||
*/
|
||||
public int getRequests() {
|
||||
return this.requests.get();
|
||||
public float getRequests() {
|
||||
return this.requests.getPreviousIntervalValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param inc How much to add to requests.
|
||||
*/
|
||||
public void incrementRequests(final int inc) {
|
||||
synchronized(this.requests) {
|
||||
this.requests.inc(inc);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
@ -140,7 +136,7 @@ public class RegionServerMetrics implements Updater {
|
|||
seconds = 1;
|
||||
}
|
||||
sb = Strings.appendKeyValue(sb, "request",
|
||||
Integer.valueOf(this.requests.get()/seconds));
|
||||
Float.valueOf(this.requests.getPreviousIntervalValue()));
|
||||
sb = Strings.appendKeyValue(sb, "regions",
|
||||
Integer.valueOf(this.regions.get()));
|
||||
sb = Strings.appendKeyValue(sb, "stores",
|
||||
|
|
Loading…
Reference in New Issue