HBASE-12779 SplitTransaction: Add metrics.
This commit is contained in:
parent
c348cd327b
commit
7774f964e6
|
@ -118,6 +118,16 @@ public interface MetricsRegionServerSource extends BaseSource {
|
||||||
*/
|
*/
|
||||||
void updateSplitTime(long t);
|
void updateSplitTime(long t);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Increment number of a requested splits
|
||||||
|
*/
|
||||||
|
void incrSplitRequest();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Increment number of successful splits
|
||||||
|
*/
|
||||||
|
void incrSplitSuccess();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the flush time histogram
|
* Update the flush time histogram
|
||||||
* @param t time it took, in milliseconds
|
* @param t time it took, in milliseconds
|
||||||
|
@ -170,6 +180,8 @@ public interface MetricsRegionServerSource extends BaseSource {
|
||||||
String PERCENT_FILES_LOCAL = "percentFilesLocal";
|
String PERCENT_FILES_LOCAL = "percentFilesLocal";
|
||||||
String PERCENT_FILES_LOCAL_DESC =
|
String PERCENT_FILES_LOCAL_DESC =
|
||||||
"The percent of HFiles that are stored on the local hdfs data node.";
|
"The percent of HFiles that are stored on the local hdfs data node.";
|
||||||
|
String SPLIT_QUEUE_LENGTH = "splitQueueLength";
|
||||||
|
String SPLIT_QUEUE_LENGTH_DESC = "Length of the queue for splits.";
|
||||||
String COMPACTION_QUEUE_LENGTH = "compactionQueueLength";
|
String COMPACTION_QUEUE_LENGTH = "compactionQueueLength";
|
||||||
String LARGE_COMPACTION_QUEUE_LENGTH = "largeCompactionQueueLength";
|
String LARGE_COMPACTION_QUEUE_LENGTH = "largeCompactionQueueLength";
|
||||||
String SMALL_COMPACTION_QUEUE_LENGTH = "smallCompactionQueueLength";
|
String SMALL_COMPACTION_QUEUE_LENGTH = "smallCompactionQueueLength";
|
||||||
|
@ -257,5 +269,9 @@ public interface MetricsRegionServerSource extends BaseSource {
|
||||||
+ "larger than blockingMemStoreSize";
|
+ "larger than blockingMemStoreSize";
|
||||||
|
|
||||||
String SPLIT_KEY = "splitTime";
|
String SPLIT_KEY = "splitTime";
|
||||||
|
String SPLIT_REQUEST_KEY = "splitRequestCount";
|
||||||
|
String SPLIT_REQUEST_DESC = "Number of splits requested";
|
||||||
|
String SPLIT_SUCCESS_KEY = "splitSuccessCounnt";
|
||||||
|
String SPLIT_SUCCESS_DESC = "Number of successfully executed splits";
|
||||||
String FLUSH_KEY = "flushTime";
|
String FLUSH_KEY = "flushTime";
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,6 +153,11 @@ public interface MetricsRegionServerWrapper {
|
||||||
*/
|
*/
|
||||||
int getPercentFileLocal();
|
int getPercentFileLocal();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the size of the split queue
|
||||||
|
*/
|
||||||
|
int getSplitQueueSize();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the size of the compaction queue
|
* Get the size of the compaction queue
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -48,6 +48,8 @@ public class MetricsRegionServerSourceImpl
|
||||||
private final MutableCounterLong slowGet;
|
private final MutableCounterLong slowGet;
|
||||||
private final MutableCounterLong slowIncrement;
|
private final MutableCounterLong slowIncrement;
|
||||||
private final MutableCounterLong slowAppend;
|
private final MutableCounterLong slowAppend;
|
||||||
|
private final MutableCounterLong splitRequest;
|
||||||
|
private final MutableCounterLong splitSuccess;
|
||||||
|
|
||||||
private final MetricHistogram splitTimeHisto;
|
private final MetricHistogram splitTimeHisto;
|
||||||
private final MetricHistogram flushTimeHisto;
|
private final MetricHistogram flushTimeHisto;
|
||||||
|
@ -83,6 +85,9 @@ public class MetricsRegionServerSourceImpl
|
||||||
|
|
||||||
splitTimeHisto = getMetricsRegistry().newHistogram(SPLIT_KEY);
|
splitTimeHisto = getMetricsRegistry().newHistogram(SPLIT_KEY);
|
||||||
flushTimeHisto = getMetricsRegistry().newHistogram(FLUSH_KEY);
|
flushTimeHisto = getMetricsRegistry().newHistogram(FLUSH_KEY);
|
||||||
|
|
||||||
|
splitRequest = getMetricsRegistry().newCounter(SPLIT_REQUEST_KEY, SPLIT_REQUEST_DESC, 0l);
|
||||||
|
splitSuccess = getMetricsRegistry().newCounter(SPLIT_SUCCESS_KEY, SPLIT_SUCCESS_DESC, 0l);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -140,6 +145,16 @@ public class MetricsRegionServerSourceImpl
|
||||||
slowAppend.incr();
|
slowAppend.incr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void incrSplitRequest() {
|
||||||
|
splitRequest.incr();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void incrSplitSuccess() {
|
||||||
|
splitSuccess.incr();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSplitTime(long t) {
|
public void updateSplitTime(long t) {
|
||||||
splitTimeHisto.add(t);
|
splitTimeHisto.add(t);
|
||||||
|
@ -198,6 +213,8 @@ public class MetricsRegionServerSourceImpl
|
||||||
rsWrap.getDataInMemoryWithoutWAL())
|
rsWrap.getDataInMemoryWithoutWAL())
|
||||||
.addGauge(Interns.info(PERCENT_FILES_LOCAL, PERCENT_FILES_LOCAL_DESC),
|
.addGauge(Interns.info(PERCENT_FILES_LOCAL, PERCENT_FILES_LOCAL_DESC),
|
||||||
rsWrap.getPercentFileLocal())
|
rsWrap.getPercentFileLocal())
|
||||||
|
.addGauge(Interns.info(SPLIT_QUEUE_LENGTH, SPLIT_QUEUE_LENGTH_DESC),
|
||||||
|
rsWrap.getSplitQueueSize())
|
||||||
.addGauge(Interns.info(COMPACTION_QUEUE_LENGTH, COMPACTION_QUEUE_LENGTH_DESC),
|
.addGauge(Interns.info(COMPACTION_QUEUE_LENGTH, COMPACTION_QUEUE_LENGTH_DESC),
|
||||||
rsWrap.getCompactionQueueSize())
|
rsWrap.getCompactionQueueSize())
|
||||||
.addGauge(Interns.info(FLUSH_QUEUE_LENGTH, FLUSH_QUEUE_LENGTH_DESC),
|
.addGauge(Interns.info(FLUSH_QUEUE_LENGTH, FLUSH_QUEUE_LENGTH_DESC),
|
||||||
|
|
|
@ -413,6 +413,9 @@ public class CompactSplitThread implements CompactionRequestor, PropagatingConfi
|
||||||
return shortCompactions.getQueue().size();
|
return shortCompactions.getQueue().size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getSplitQueueSize() {
|
||||||
|
return splits.getQueue().size();
|
||||||
|
}
|
||||||
|
|
||||||
private boolean shouldSplitRegion() {
|
private boolean shouldSplitRegion() {
|
||||||
return (regionSplitLimit > server.getNumberOfOnlineRegions());
|
return (regionSplitLimit > server.getNumberOfOnlineRegions());
|
||||||
|
|
|
@ -99,6 +99,14 @@ public class MetricsRegionServer {
|
||||||
serverSource.updateSplitTime(t);
|
serverSource.updateSplitTime(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void incrSplitRequest() {
|
||||||
|
serverSource.incrSplitRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void incrSplitSuccess() {
|
||||||
|
serverSource.incrSplitSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
public void updateFlushTime(long t) {
|
public void updateFlushTime(long t) {
|
||||||
serverSource.updateFlushTime(t);
|
serverSource.updateFlushTime(t);
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,6 +178,14 @@ class MetricsRegionServerWrapperImpl
|
||||||
return regionServer.rpcServices.requestCount.get();
|
return regionServer.rpcServices.requestCount.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSplitQueueSize() {
|
||||||
|
if (this.regionServer.compactSplitThread == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return this.regionServer.compactSplitThread.getSplitQueueSize();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getCompactionQueueSize() {
|
public int getCompactionQueueSize() {
|
||||||
//The thread could be zero. if so assume there is no queue.
|
//The thread could be zero. if so assume there is no queue.
|
||||||
|
|
|
@ -62,6 +62,7 @@ class SplitRequest implements Runnable {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
|
server.metricsRegionServer.incrSplitRequest();
|
||||||
long startTime = EnvironmentEdgeManager.currentTime();
|
long startTime = EnvironmentEdgeManager.currentTime();
|
||||||
SplitTransaction st = new SplitTransaction(parent, midKey);
|
SplitTransaction st = new SplitTransaction(parent, midKey);
|
||||||
try {
|
try {
|
||||||
|
@ -129,6 +130,7 @@ class SplitRequest implements Runnable {
|
||||||
// Update regionserver metrics with the split transaction total running time
|
// Update regionserver metrics with the split transaction total running time
|
||||||
server.metricsRegionServer.updateSplitTime(endTime - startTime);
|
server.metricsRegionServer.updateSplitTime(endTime - startTime);
|
||||||
if (success) {
|
if (success) {
|
||||||
|
server.metricsRegionServer.incrSplitSuccess();
|
||||||
// Log success
|
// Log success
|
||||||
LOG.info("Region split, hbase:meta updated, and report to master. Parent="
|
LOG.info("Region split, hbase:meta updated, and report to master. Parent="
|
||||||
+ parent.getRegionNameAsString() + ", new regions: "
|
+ parent.getRegionNameAsString() + ", new regions: "
|
||||||
|
|
|
@ -255,4 +255,9 @@ public class MetricsRegionServerWrapperStub implements MetricsRegionServerWrappe
|
||||||
public long getBlockedRequestsCount() {
|
public long getBlockedRequestsCount() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSplitQueueSize() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue