HBASE-20672 New metrics ReadRequestRate and WriteRequestRate

Signed-off-by: Andrew Purtell <apurtell@apache.org>
This commit is contained in:
Ankit 2018-06-07 15:03:03 -07:00 committed by Andrew Purtell
parent b4eacdabd6
commit e66a6603e3
5 changed files with 60 additions and 1 deletions

View File

@ -256,6 +256,9 @@ public interface MetricsRegionServerSource extends BaseSource, JvmPauseMonitorSo
String READ_REQUEST_COUNT = "readRequestCount";
String READ_REQUEST_COUNT_DESC =
"Number of read requests with non-empty Results that this RegionServer has answered.";
String READ_REQUEST_RATE_PER_SECOND = "readRequestRatePerSecond";
String READ_REQUEST_RATE_DESC =
"Rate of answering the read requests by this region server per second.";
String CP_REQUEST_COUNT = "cpRequestCount";
String CP_REQUEST_COUNT_DESC =
"Number of coprocessor service requests this region server has answered.";
@ -265,6 +268,9 @@ public interface MetricsRegionServerSource extends BaseSource, JvmPauseMonitorSo
String WRITE_REQUEST_COUNT = "writeRequestCount";
String WRITE_REQUEST_COUNT_DESC =
"Number of mutation requests this RegionServer has answered.";
String WRITE_REQUEST_RATE_PER_SECOND = "writeRequestRatePerSecond";
String WRITE_REQUEST_RATE_DESC =
"Rate of answering the mutation requests by this region server per second.";
String CHECK_MUTATE_FAILED_COUNT = "checkMutateFailedCount";
String CHECK_MUTATE_FAILED_COUNT_DESC =
"Number of Check and Mutate calls that failed the checks.";

View File

@ -140,6 +140,11 @@ public interface MetricsRegionServerWrapper {
*/
long getCpRequestsCount();
/**
* Get the rate of read requests per second to regions hosted on this region server.
*/
double getReadRequestsRatePerSecond();
/**
* Get the number of filtered read requests to regions hosted on this region server.
*/
@ -150,6 +155,11 @@ public interface MetricsRegionServerWrapper {
*/
long getWriteRequestsCount();
/**
* Get the rate of write requests per second to regions hosted on this region server.
*/
double getWriteRequestsRatePerSecond();
/**
* Get the number of CAS operations that failed.
*/

View File

@ -546,7 +546,11 @@ public class MetricsRegionServerSourceImpl
.addGauge(Interns.info(MOB_FILE_CACHE_COUNT, MOB_FILE_CACHE_COUNT_DESC),
rsWrap.getMobFileCacheCount())
.addGauge(Interns.info(MOB_FILE_CACHE_HIT_PERCENT, MOB_FILE_CACHE_HIT_PERCENT_DESC),
rsWrap.getMobFileCacheHitPercent());
rsWrap.getMobFileCacheHitPercent())
.addGauge(Interns.info(READ_REQUEST_RATE_PER_SECOND, READ_REQUEST_RATE_DESC),
rsWrap.getReadRequestsRatePerSecond())
.addGauge(Interns.info(WRITE_REQUEST_RATE_PER_SECOND, WRITE_REQUEST_RATE_DESC),
rsWrap.getWriteRequestsRatePerSecond());
}
@Override

View File

@ -74,9 +74,11 @@ class MetricsRegionServerWrapperImpl
private volatile long numReferenceFiles = 0;
private volatile double requestsPerSecond = 0.0;
private volatile long readRequestsCount = 0;
private volatile double readRequestsRatePerSecond = 0;
private volatile long cpRequestsCount = 0;
private volatile long filteredReadRequestsCount = 0;
private volatile long writeRequestsCount = 0;
private volatile double writeRequestsRatePerSecond = 0;
private volatile long checkAndMutateChecksFailed = 0;
private volatile long checkAndMutateChecksPassed = 0;
private volatile long storefileIndexSize = 0;
@ -524,6 +526,11 @@ class MetricsRegionServerWrapperImpl
return cpRequestsCount;
}
@Override
public double getReadRequestsRatePerSecond() {
return readRequestsRatePerSecond;
}
@Override
public long getFilteredReadRequestsCount() {
return filteredReadRequestsCount;
@ -534,6 +541,11 @@ class MetricsRegionServerWrapperImpl
return writeRequestsCount;
}
@Override
public double getWriteRequestsRatePerSecond() {
return writeRequestsRatePerSecond;
}
@Override
public long getRpcGetRequestsCount() {
return regionServer.rpcServices.rpcGetRequestCount.sum();
@ -716,6 +728,8 @@ class MetricsRegionServerWrapperImpl
private long lastRan = 0;
private long lastRequestCount = 0;
private long lastReadRequestsCount = 0;
private long lastWriteRequestsCount = 0;
@Override
synchronized public void run() {
@ -852,6 +866,21 @@ class MetricsRegionServerWrapperImpl
requestsPerSecond = (currentRequestCount - lastRequestCount) /
((currentTime - lastRan) / 1000.0);
lastRequestCount = currentRequestCount;
long intervalReadRequestsCount = tempReadRequestsCount - lastReadRequestsCount;
long intervalWriteRequestsCount = tempWriteRequestsCount - lastWriteRequestsCount;
double readRequestsRatePerMilliSecond = ((double)intervalReadRequestsCount/
(double)period);
double writeRequestsRatePerMilliSecond = ((double)intervalWriteRequestsCount/
(double)period);
readRequestsRatePerSecond = readRequestsRatePerMilliSecond * 1000.0;
writeRequestsRatePerSecond = writeRequestsRatePerMilliSecond * 1000.0;
lastReadRequestsCount = tempReadRequestsCount;
lastWriteRequestsCount = tempWriteRequestsCount;
}
lastRan = currentTime;

View File

@ -100,6 +100,11 @@ public class MetricsRegionServerWrapperStub implements MetricsRegionServerWrappe
return 899;
}
@Override
public double getReadRequestsRatePerSecond() {
return 10.0;
}
@Override
public long getTotalRowActionRequestCount() {
return getReadRequestsCount() + getWriteRequestsCount();
@ -125,6 +130,11 @@ public class MetricsRegionServerWrapperStub implements MetricsRegionServerWrappe
return 707;
}
@Override
public double getWriteRequestsRatePerSecond() {
return 10.0;
}
@Override
public long getRpcGetRequestsCount() {
return 521;