HBASE-5189 Add metrics to keep track of region-splits in RS

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1292139 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2012-02-22 06:51:02 +00:00
parent 6da328e0fb
commit 953d89e3a9
2 changed files with 20 additions and 0 deletions

View File

@ -65,6 +65,7 @@ class SplitRequest implements Runnable {
if (!st.prepare()) return;
try {
st.execute(this.server, this.server);
this.server.getMetrics().incrementSplitSuccessCount();
} catch (Exception e) {
try {
LOG.info("Running rollback/cleanup of failed split of " +
@ -72,6 +73,7 @@ class SplitRequest implements Runnable {
if (st.rollback(this.server, this.server)) {
LOG.info("Successful rollback of failed split of " +
parent.getRegionNameAsString());
this.server.getMetrics().incrementSplitFailureCount();
} else {
this.server.abort("Abort; we got an error after point-of-no-return");
}
@ -92,6 +94,7 @@ class SplitRequest implements Runnable {
} catch (IOException ex) {
LOG.error("Split failed " + this, RemoteExceptionHandler
.checkIOException(ex));
this.server.getMetrics().incrementSplitFailureCount();
server.checkFileSystem();
}
}

View File

@ -38,6 +38,7 @@ import org.apache.hadoop.metrics.util.MetricsIntValue;
import org.apache.hadoop.metrics.util.MetricsLongValue;
import org.apache.hadoop.metrics.util.MetricsRegistry;
import org.apache.hadoop.metrics.util.MetricsTimeVaryingRate;
import org.apache.hadoop.metrics.util.MetricsTimeVaryingLong;
import org.apache.hadoop.util.StringUtils;
import java.io.IOException;
@ -238,6 +239,12 @@ public class RegionServerMetrics implements Updater {
public final MetricsTimeVaryingRate slowHLogAppendTime =
new MetricsTimeVaryingRate("slowHLogAppendTime", registry);
public final MetricsTimeVaryingLong regionSplitSuccessCount =
new MetricsTimeVaryingLong("regionSplitSuccessCount", registry);
public final MetricsTimeVaryingLong regionSplitFailureCount =
new MetricsTimeVaryingLong("regionSplitFailureCount", registry);
public RegionServerMetrics() {
MetricsContext context = MetricsUtil.getContext("hbase");
@ -354,6 +361,8 @@ public class RegionServerMetrics implements Updater {
this.flushTime.pushMetric(this.metricsRecord);
this.flushSize.pushMetric(this.metricsRecord);
this.slowHLogAppendCount.pushMetric(this.metricsRecord);
this.regionSplitSuccessCount.pushMetric(this.metricsRecord);
this.regionSplitFailureCount.pushMetric(this.metricsRecord);
}
this.metricsRecord.update();
}
@ -411,6 +420,14 @@ public class RegionServerMetrics implements Updater {
public void incrementRequests(final int inc) {
this.requests.inc(inc);
}
public void incrementSplitSuccessCount() {
this.regionSplitSuccessCount.inc();
}
public void incrementSplitFailureCount() {
this.regionSplitFailureCount.inc();
}
@Override
public String toString() {